🎯 Checkpoint: decide & repeat
Why: Prove decisions and loops stuck: if / elif / else, for, while.
Unlocks: The building section — lists, functions, and your first real project.
Checkpoint time — nothing new, everything yours. Two lessons ago your programs ran top to bottom, every line, every time. Now they branch and they repeat — that's 90% of what any program does. Predict what each snippet does before touching anything; the whole point is reading code with your eyes, not running it with your finger.
| Tool | What it does | Watch out for |
|---|---|---|
| if / elif / else | Runs a branch only when its condition is true | Only the FIRST true branch runs |
| for i in range(5) | Repeats with i = 0, 1, 2, 3, 4 | Starts at 0, stops BEFORE 5 |
| while condition | Repeats as long as the condition stays true | Something inside must change, or it never ends |
| Indented lines | Belong to the if / for / while above them | Un-indented lines run after, no matter what |
How many lines does this print?
The user types 75. What prints?
What is wrong with this loop?
Final task — from memory. Write a countdown: print 3, 2, 1, each on its own line, then Go!. Loop or no loop — builder's choice.
Checkpoint cleared 🎉 Branching and looping are the engine of every game, app and robot. Next section you get the cargo: lists to hold many things, functions to name your recipes — then the capstone project.