Single lesson · Written for OCR J277

Boolean logic in programs – OCR GCSE Computer Science lesson (J277)

Pupils learn to write Python conditions with AND, OR and NOT that match a rule, and use a truth table to test them.

Also in a bundle Binary, Boolean Logic and Iteration – OCR GCSE Computer Science lessons (J277) 11 lessons for £39 · save 11% on buying separately

Lesson 10 of 11 in unit 10.3 Binary, Boolean Logic and Iteration, taught in Year 10, Spring 1. It answers one big question: How do logic gates show up in the code we write?

By the end, pupils can write Python conditions with AND, OR and NOT that match a rule, and use a truth table to test them.

The Build (the main task)
Write a Python program for the smart heating that inputs the temperature and whether anyone is home (Y or N), and applies Boolean logic to print 'Heating on' if it is below 18 °C and someone is home, or if it is below 3 °C; otherwise 'Heating off'.
Support version
Part-filled code: the inputs and print lines are written; pupils complete the condition from a bank of parts (temp < 18, home == "Y", temp < 3, and, or, brackets).
Challenge
Complete a truth table for the heating condition and use it to choose four test values that check every outcome.
Real-world link
The smart heating decides for itself when to switch on – including a frost guard when no one is home.
Key words
Boolean logic, Boolean operator and Apply, each with a definition, an icon and a common mix-up on the key vocabulary slide.
Misconceptions it tackles
“OR is False when both sides are True”; “home == "Y" or "y" checks for either letter”.
OCR J277 specification
2.4.1 (boolean logic: AND, OR and NOT gates, their symbols and truth tables; logic diagrams and Boolean expressions with up to three inputs; applying logical operators in programs); 2.2.1 (programming fundamentals: iteration – count-controlled loops (FOR) and condition-controlled loops (WHILE, DO UNTIL); Boolean operators in conditions).

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 Binary, Boolean Logic and Iteration 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)
  • Boolean logic in programs - Quiz Quiz Trade Cards
  • 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.