Python 3: While Loops, Boolean Logic & Game Project | KS3 Computing
The third Python pack — and the one where your students stop following programs and start controlling them. This complete pack takes a Year 7–9 class from print, variables, if/else, for loops, lists and functions into the ideas every real program depends on: while loops that repeat until a condition changes, elif chains, Boolean logic, input validation, and random numbers — across two ready-to-teach 60-minute lessons, ending with two games the students build themselves.
Lesson 1 covers while loops: condition-controlled repetition, how a while loop differs from a for loop, sentinel values, and the infinite loop — what causes one, how to stop it with Ctrl+C, and how to fix it. It adds elif chains, including why the order of conditions matters, and Boolean logic with and, or and not, worked out with truth tables. Lesson 2 turns the ideas into something students can play: input validation that keeps asking until the user enters a number in range, then the capstone — a number-guessing game and a rock-paper-scissors game built from while loops, conditions, Boolean logic and random numbers, with a best-of-three match as the challenge.
Every task follows the same rule as the earlier packs: predict the output before you run the program. The worksheet works with computers or entirely on paper — every program can be traced by hand. A full answer key with every output, every model program and marking notes is included, and the pack closes with a 10-question quiz.
This resource was created with AI assistance and reviewed and revised by the author.
What’s included: full lesson plan (two lessons, ~60 minutes each, with objectives, starters, worked examples, timings, a ten-error reference table, differentiation and assessment guidance); student worksheet (printable A4 — seven tasks plus best-of-three challenge); quiz with answer key.
Who it’s for: computing teachers continuing Python with students aged 11–14 (KS3, Years 7–9) who have covered print, variables, input, if/else, for loops, lists and functions — ideally with the “Introduction to Python: First Lessons Pack” and “Python 2: Lists, Functions and Debugging”. Non-specialist and cover teachers too — all code is correct, runnable Python 3.
How to use it: print one worksheet and one quiz per student; teach Lesson 1, then Lesson 2 the following lesson; mark with the answer key.
Covers the KS3 computing programming core: iteration with while loops, selection with if/elif/else, Boolean logic and truth tables, input validation, random numbers, and fixing syntax, runtime and logic errors. Files are print-ready PDFs.