Comparison operators and testing – Year 7 Computing lesson
Pupils learn to use the six comparison operators and test a program with normal, boundary and erroneous data, writing the expected result before each test.
Lesson 5 of 6 in unit 7.6 Introduction to Python, taught in Year 7, Summer 2. It answers one big question: How do we prove our program makes the right decisions?
By the end, pupils can use the six comparison operators and test a program with normal, boundary and erroneous data, writing the expected result before each test.
- The Build (the main task)
- Complete a test plan for the bowl program: choose normal, boundary and erroneous test data, write the expected result for each, run the tests and fix the bug you find.
- Support version
- Part-filled test plan: the test data and its type are chosen; pupils write the expected result, run each test and record the actual result.
- Challenge
- Explain why testing 8 and 9 finds the bug but testing 3 and 20 does not.
- Real-world link
- Testing the recipe helper before the food technology teacher uses it with a class.
- Key words
- Comparison operator, Test data and Expected, each with a definition, an icon and a common mix-up on the key vocabulary slide.
- Misconceptions it tackles
- “Testing with a few normal values is enough to show a program works”; “> and >= give the same result”.
- National Curriculum
- NC3 (two or more languages, at least one textual; data structures; modular programs with procedures or functions); NC4 (boolean logic (AND, OR, NOT) in circuits and programming; binary numbers, addition and conversion).
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 Introduction to Python 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)
- Comparison operators and testing - Quiz Quiz Trade Cards
- Single-teacher licence: use and adapt it with your own classes
More for KS3 Computing
See allPupils learn to write and run a Python program that uses print to output text, and fix syntax errors by reading the error message.
Free sample lessonPupils learn to use input to ask the user a question, store the answer in a variable by assignment and use a constant for a value that never changes.
Pupils learn to choose the right data type for a value, convert input to a number and use arithmetic operators to calculate the ingredients for a scaled recipe.
Written for the specifications named. Not endorsed by or affiliated with any exam board.