Single lesson · Written for OCR J277

Comparison and Boolean operators in conditions – OCR GCSE Computer Science lesson (J277)

Pupils learn to use comparison operators and the Boolean operators AND, OR and NOT to write conditions that combine two tests.

Also in a bundle Memory, Storage and Selection – OCR GCSE Computer Science lessons (J277) 14 lessons for £39 · save 30% on buying separately

Lesson 6 of 14 in unit 10.2 Memory, Storage and Selection, taught in Year 10, Autumn 2. It answers one big question: How can one IF statement test more than one thing?

By the end, pupils can use comparison operators and the Boolean operators AND, OR and NOT to write conditions that combine two tests.

The Build (the main task)
Write a Python program that inputs a visitor's age and whether they have done the gym induction (Y or N), and uses comparison and Boolean operators to print 'Gym allowed' only if they are 16 or over and have done the induction.
Support version
Part-filled code: the inputs and print lines are written; pupils fill the gaps in the condition from a bank of operators (==, >=, >, and, or).
Challenge
Rewrite the condition so it prints 'Gym not allowed' using NOT, and explain why the result is the same.
Real-world link
The gym only lets in visitors who are old enough and have done their induction.
Key words
Comparison operator, Boolean operator and Combine, each with a definition, an icon and a common mix-up on the key vocabulary slide.
Misconceptions it tackles
“OR is only True when both conditions are True”; “= and == mean the same thing”.
OCR J277 specification
2.2.1 (programming fundamentals: selection (IF, ELSE IF, nested IF and CASE), comparison operators and Boolean operators AND, OR, NOT).

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.

Pupils need computers for the main task.

Also sold in the Memory, Storage and Selection 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 GCSE Computer Science (OCR)

See all

Written for the specifications named. Not endorsed by or affiliated with any exam board.