Lesson 30 of 30
Lesson 30 ? Final project: Python fun fair
Title: Build a small program with many Python skills
Description: Finish the course by making a fun fair menu with games, prizes, points, and friendly messages.
Why it matters for kids: The final project shows that you can combine many simple ideas into one bigger program.
1. Start with a welcome
print("Welcome to the Python Fun Fair!")
player_name = input("What is your name? ")
print(f"Have fun, {player_name}!")2. Keep score
score = 0
score = score + 10
print("Score:", score)
score = score + 5
print("Score:", score)3. Add a random prize
import random
prizes = ["sticker", "toy robot", "gold star"]
prize = random.choice(prizes)
print("You won a", prize)4. Make a menu
print("1. Roll dice")
print("2. Get prize")
print("3. Quit")
choice = input("Choose: ")
if choice == "1":
print("Rolling dice...")
elif choice == "2":
print("Prize time!")
else:
print("Goodbye!")5. Put it together
import random
score = 0
prizes = ["sticker", "balloon", "tiny trophy"]
print("Welcome to the Python Fun Fair!")
choice = input("Choose dice or prize: ").lower()
if choice == "dice":
roll = random.randint(1, 6)
score = score + roll
print("You rolled:", roll)
elif choice == "prize":
print("Prize:", random.choice(prizes))
else:
print("Maybe next time.")
print("Final score:", score)6. Project ideas
Try adding:
- A password to enter the fair.
- A list of players.
- A pet helper at the fair.
- A text file that saves the final score.
- Turtle art for a fair flag.
7. Mini challenge
Click each example to open it.
Example 1
Print a welcome message.
Example 2
Ask for the player name.
Example 3
Create score = 0.
Example 4
Add 10 points to the score.
Example 5
Create a list of prizes.
Example 6
Pick a random prize.
Example 7
Show a menu with three choices.
Example 8
Add a dice roll choice.
Example 9
Add a prize choice.
Example 10
Build your own tiny fun fair program.