fayotech.academy🐍 Python: First Steps
Decide & repeat

🎯 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.

ToolWhat it doesWatch out for
if / elif / elseRuns a branch only when its condition is trueOnly the FIRST true branch runs
for i in range(5)Repeats with i = 0, 1, 2, 3, 4Starts at 0, stops BEFORE 5
while conditionRepeats as long as the condition stays trueSomething inside must change, or it never ends
Indented linesBelong to the if / for / while above themUn-indented lines run after, no matter what
Quick challenge

How many lines does this print?

Quick challenge

The user types 75. What prints?

Quick challenge

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.