Project 5 — Snake! 🐍
The classic Snake game. A blue snake slides across a green checkerboard, you steer it with the arrow keys, and you try to eat as many apples as you can without hitting a wall or your own tail.
🎯 What you’ll build
A complete Snake game. The pieces:
- 20×20 green checker board
- A blue snake that slides and grows
- A red apple that pops up at a random spot when eaten
- A score that climbs each time you eat
- A Game Over screen when you crash
🧩 Python you’ll use
No brand-new ideas! You already know everything:
turtlefor drawing (Projects 2, 3, 4)- Functions with
def(Project 1) forloops (Project 3)if/elif/else(Project 2)random.randint(Project 1)- Lists — to hold the snake’s body segments (this is the one bit you haven’t done much of — we’ll go gently)
-
screen.ontimerandscreen.onkey— the game loop and arrow keys (we’ll explain) - 🧩 5 steps — each step adds a chunk of code
- ⏱️ About 60 minutes (it’s the biggest project!)
- 🎨 Type: Design — follow the steps, then tweak
About this project: Snake isn’t part of RPF’s original intro path. It’s our addition — same teaching style, same editor. The full Snake code is shown at every step so you can tap 💡 Solution to see how it all fits together.