# imports
from datetime import datetime
from random import randint
# variables
world = '🌍🌎🌏'
python = 'Python 🐍'
fire = '🔥'
# Function definitions
def roll_dice():
print(f'You rolled a {4}')
# 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}')
print(f'The date and time is {datetime.now()}')
roll_dice()
Project 1 — Step 11 of 16
⭐ Step 11 — Import randint
➡️ Bring in another module called random — it can pick random
numbers for us.
✏️ What to type
Under your existing from datetime line, add:
from random import randint
# imports
from datetime import datetime
# variables
world = '🌍🌎🌏'
python = 'Python 🐍'
fire = '🔥'
# Function definitions
def roll_dice():
print(f'You rolled a {4}')
# 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}')
print(f'The date and time is {datetime.now()}')
roll_dice()
Tap ▶ Run. The output stays the same as last step. We imported a tool but haven’t used it yet.
Adapted from Raspberry Pi Foundation — Hello World under CC BY-SA 4.0.