Variables, constants, input and output – OCR GCSE Computer Science lesson (J277)
Pupils learn to write a Python program that uses input, output, variables and a named constant, storing each value by assignment.
Lesson 4 of 13 in unit 10.1 Systems Architecture and First Programs, taught in Year 10, Autumn 1. It answers one big question: How does a program store and use what the user types?
By the end, pupils can write a Python program that uses input, output, variables and a named constant, storing each value by assignment.
- The Build (the main task)
- Write a Python program that asks for the trip name and the lead teacher, stores each answer in a variable, and prints a two-line summary that uses the constant MAX_PLACES.
- Support version
- Part-filled code: the constant and the first input line are written; pupils complete the second input and the two print lines.
- Challenge
- Explain why MAX_PLACES should be a constant but trip_name should be a variable.
- Real-world link
- The trip planner starts by asking the trip's name and lead teacher, and keeps the maximum number of places as a constant.
- Key words
- Variable, Constant and Value, each with a definition, an icon and a common mix-up on the key vocabulary slide.
- Misconceptions it tackles
- “When a variable is given a new value, it keeps the old value as well”; “A constant is any number typed straight into the code”.
- OCR J277 specification
- 2.2.1 (programming fundamentals: variables, constants, operators, input, output, assignment, sequence).
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 Systems Architecture and First Programs 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 allPupils learn to describe a computer system as input, process, storage and output, and write an algorithm as precise numbered steps for a stated purpose.
Free sample lessonPupils learn to decompose a problem into smaller sub-problems in a structure diagram and use abstraction to decide which details a solution needs and which it can ignore.
Pupils learn to state the purpose of the CPU and describe von Neumann architecture, in which instructions and data are stored together in the same memory.
Written for the specifications named. Not endorsed by or affiliated with any exam board.