Recap: loops and selection – Year 9 Computing lesson
Pupils learn to trace a program that uses a loop and nested selection in a trace table, and use it to predict the program's output.
Lesson 1 of 6 in unit 9.1 Python: Lists and Functions, taught in Year 9, Autumn 1. It answers one big question: How can we predict what a program does before running it?
By the end, pupils can trace a program that uses a loop and nested selection in a trace table, and use it to predict the program's output.
- The Build (the main task)
- Complete a trace table for the games-club scoring program, then predict its output and run the program to check.
- Support version
- Part-filled trace table: the first two passes are filled in, and the columns and rows for the rest are drawn.
- Challenge
- Change one condition so a player with exactly 10 points also gets the bonus, and say which rows of the trace table change.
- Real-world link
- Game apps award bonus points with rules inside rules; today pupils predict what a games-club scoring program will print before they run it.
- Key words
- Trace table, Nested selection and Predict, each with a definition, an icon and a common mix-up on the key vocabulary slide.
- Misconceptions it tackles
- “The inner IF of nested selection is still checked when the outer IF is False”; “A trace table only needs the final value of each variable”.
- National Curriculum
- NC3 (two or more languages, at least one textual; data structures; modular programs with procedures or functions).
Every lesson follows the same Code & Commerce structure: a Bell Task recall starter, key vocabulary with definitions and icons, short teaching chunks with a check before pupils move on, The Build (one main task), challenge questions that get harder, and an exit question. Answers reveal one at a time on the slides, and everything is editable PowerPoint and Word.
- Also sold in the Python
- Lists and Functions unit bundle, which includes the medium term plan, and in the full-year and complete-course bundles.
What's included
- Slide deck (PowerPoint)
- Lesson plan (Word)
- Worksheet (Word)
- Support worksheet with scaffolds (Word)
- Single-teacher licence: use and adapt it with your own classes
More for KS3 Computing
See allPupils learn to create a list, access and change an item using its index, and find how many items it holds with len().
Pupils learn to append items to a list and traverse it with a for loop to print, count or total every item.
Pupils learn to define and call a procedure and a function, and explain that a function returns a value but a procedure does not.
Written for the specifications named. Not endorsed by or affiliated with any exam board.