Decisions and loops
Blocks, selection with if, elif and match, Boolean operators, for and while loops and the patterns they make: the robot starts reacting to what its sensors say.
Start in the simulator- F2.1 Blocks and indentation How Python groups lines: the colon and the indent.
- F2.2 Selection: if Relational operators, and a block that runs only when a condition is true.
- F2.3 else, elif and Boolean operators Choosing between outcomes, and joining conditions with and, or and not.
- F2.4 Nested selection and match Decisions inside decisions, and choosing by exact value with a case statement.
- F2.5 Count-controlled loops: for range, the loop variable, and repeating a known number of times.
- F2.6 Condition-controlled loops: while Looping until something changes, break, and loops that never end.
- F2.7 Loop patterns Running totals, counting, finding the largest, nested loops and trace tables.
- F2.8 Project: parking sensor A while loop, decisions and the buzzer: beep faster as the wall gets closer, and park.