Coding · Grade 9
Selection and Repetition
Built around a school weather station, the course develops selection (elif chains, nested conditions, branch order and boundaries) and Boolean logic (short-circuit evaluation and De Morgan's laws), then repetition patterns with for, while, break, continue, sentinels and nested loops. It closes with reasoning about loop correctness: termination, off-by-one errors and loop invariants.
- 4 lessons
- About 90 minutes
- Check what you learned: 8 questions
- Ways to answer: choose an answer, put code in order, trace code, match pairs, type a number and sort into groups
What learners will discover
- Trace and order if/elif/else chains and nested conditions, testing boundary values.
- Evaluate and transform Boolean conditions using and, or, not, short-circuit evaluation and De Morgan's laws.
- Trace for and while loops with break, continue, sentinels and nested loops.
- Reason about loop correctness: termination, off-by-one errors and loop invariants.
Lessons
-
Selection: choosing the right branch 6 steps3 practiceabout 20 min
-
Boolean logic 6 steps4 practiceabout 22 min
-
Repetition patterns 5 steps3 practiceabout 22 min
-
Is the loop correct? 6 steps3 practiceabout 20 min
-
Check what you learned 8 questions at the end
Keep exploring
More 9th grade coding
- 9th Grade Coding Worksheets10 printable worksheets
Guide for grown-ups
- How to start homeschooling: a step-by-step guide for familiesA guide for parents · 7 min read