Single lesson · Written for OCR J277

Count-controlled loops (FOR) – OCR GCSE Computer Science lesson (J277)

Pupils learn to trace and write FOR loops that use range() with a start, stop and step, and use the loop variable inside the loop.

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 2 of 11 in unit 10.3 Binary, Boolean Logic and Iteration, taught in Year 10, Spring 1. It answers one big question: How can a program repeat steps a set number of times?

By the end, pupils can trace and write FOR loops that use range() with a start, stop and step, and use the loop variable inside the loop.

The Build (the main task)
Write a Python program that inputs how many lights are in the house and uses iteration (a FOR loop) to print 'Light 1 off', 'Light 2 off' and so on for every light, then 'All lights off' once at the end.
Support version
Parsons problem: the program's lines are jumbled, with one distractor line that uses range(1, lights) and misses the last light.
Challenge
Write a FOR loop with a negative step that counts the alarm down from 10 to 1, then prints 'Alarm set'.
Real-world link
The hub's 'Goodnight' button switches off every light in the house, one after another.
Key words
Iteration, Count-controlled loop and Repeat, each with a definition, an icon and a common mix-up on the key vocabulary slide.
Misconceptions it tackles
“range(1, 10) includes 10”; “Every line after the for line repeats, indented or not”.
OCR J277 specification
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)
  • 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.