Single lesson · Written for OCR J277

Selection: IF and ELSE IF – OCR GCSE Computer Science lesson (J277)

Pupils learn to write and trace Python IF, ELIF and ELSE statements so that a program takes the right branch for each input.

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

Lesson 4 of 14 in unit 10.2 Memory, Storage and Selection, taught in Year 10, Autumn 2. It answers one big question: How can a program make a different choice for different users?

By the end, pupils can write and trace Python IF, ELIF and ELSE statements so that a program takes the right branch for each input.

The Build (the main task)
Write a Python program that inputs a visitor's age and uses if, elif and else to print the swim price: under 5 free, 5 to 15 £3.00, 16 to 64 £5.50, 65 and over £3.50.
Support version
Parsons problem: the program's lines are jumbled, with one distractor line that puts the conditions in the wrong order so a 70-year-old pays £5.50.
Challenge
Explain why the order of the elif conditions matters, using an age that would get the wrong price if they were swapped.
Real-world link
The leisure centre's kiosk charges a different swim price for children, adults and over-65s.
Key words
Selection, Condition and Decision, each with a definition, an icon and a common mix-up on the key vocabulary slide.
Misconceptions it tackles
“Every branch whose condition is True runs, not just the first one”; “else needs its own condition, like else age >= 65”.
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.