🐍 Python Tutorial
# imports
from datetime import datetime

# variables
world = '🌍🌎🌏'
python = 'Python 🐍'
fire = '🔥'

# Function definitions

# Put code to run under here
print(f'Hello {world}')
print(f'Welcome to {python}')
print(f'{python} is good at maths!')
print(f'{111111111 * 111111111}')

Project 1 — Step 7 of 16

⭐ Step 7 — Using modules

➡️ Bring in the datetime module so we can use dates.

Python comes with lots of modules — packs of extra tools. To use one, you need to import it first.

The datetime module helps with anything to do with dates and times.

✏️ What to type

At the very top, under the # imports line, add:

from datetime import datetime
# imports

# variables
world = '🌍🌎🌏'
python = 'Python 🐍'
fire = '🔥'

# Function definitions

# Put code to run under here
print(f'Hello {world}')
print(f'Welcome to {python}')
print(f'{python} is good at maths!')
print(f'{111111111 * 111111111}')

Tap ▶ Run. The output stays the same — we imported the tool but haven’t used it yet. We’ll use it next step.

🔍 Tip

Any line with # in front is a comment. Python ignores it. Comments are notes from you to you (or to whoever reads your code).

💡 If you get a red error

Check that you spelled datetime correctly, and it’s all lowercase.

Next → Step 8

⬅ Back to Step 6


Adapted from Raspberry Pi Foundation — Hello World under CC BY-SA 4.0.