← All missions

🏁 Turtle Race or Screen-Saver

πŸ† Final Showcase Projects

1) What do I need to do?

🎯 Your mission: Your showcase!

Build your own racing game or screen-saver. Make it yours β€” new colours, shapes, more racers, a scoreboard, a finish message...

It must use turtle, random, and a loop, and draw lots on the screen.

2) What do I need to know?

Idea 1: Hero turtle race

Make a list of turtles, line them up, then loop: each one moves a random amount. The first past the finish line wins!

Watch how the code uses lists, loops, random, if and while β€” everything you've learned.

🧰 Your toolkit for this mission

Everything you need to know to finish this lesson on your own:

Turtle setup

Import, make a screen and turtles.

How to write it: import turtle, t = turtle.Turtle().

import turtle
t = turtle.Turtle()

Random movement

Race turtles move a random amount each turn.

How to write it: Use random.randint inside a loop.

for i in range(50):
    t.forward(random.randint(1, 10))

Screen-saver patterns

Loops + turns + colours make patterns.

How to write it: Change colour with random.choice each loop.

for i in range(36):
    t.color(random.choice(["red", "blue", "gold"]))
    t.circle(80)
    t.right(10)

Jump without drawing

Move to a start position.

How to write it: t.penup(), t.goto(x, y), t.pendown().

t.penup()
t.goto(-200, 0)
t.pendown()

Think about it

Look at this code. What happens next, and why? Say it in your own words.

if racer.xcor() >= 150:
    winner = racer
Watch & explore β–Ά

Power-up: Idea 1: Hero turtle race

See it happen

1 / 3
colours = ["red", "blue", "green"]
πŸ”΄
πŸ”΅
🟒
racers

Create a turtle for each colour, using a list and a loop.

3) Run the code & terminal output

Code Lab 🐍Playground β€” experiment freely!
Hero Terminal

Press β–Ά RUN and your program's messages appear here!

Cosmic Studio
Cosmic Studio
Your superhero companion

Captain Py

Our next adventure is yours to create.