Control Flow
Make programs decide with if and match, repeat with while and for, and learn the loop tools every Python programmer uses: range, break, enumerate, zip and :=.
So far every program you wrote ran straight from the first line to the last. Real programs need two more powers: deciding (do this only if that is true) and repeating (do this again and again until a goal is reached). Together they are called control flow, because they control which lines run and how many times.
This phase teaches decisions with if, elif, else, the one-line conditional expression and the modern match statement. It teaches repetition with while and for, the helpers that make loops short and safe (range, enumerate, zip, reversed, sorted), and the keywords that steer a loop (break, continue and the loop else).
You will also meet the walrus operator :=. Every topic has examples you can run and edit here. Lists appear in many loop examples before Phase 4 teaches them properly: for now, a list such as [3, 8, 5] is just several values kept in order, and for can visit them one by one. Functions arrive in Phase 5, so none are used here.
Practise this phase
Hands-on exercises: write the code, run it, and press Check to have it tested automatically.