Variables and input – Year 7 Computing lesson
Pupils learn to use input to ask the user a question, store the answer in a variable by assignment and use a constant for a value that never changes.
Lesson 2 of 6 in unit 7.6 Introduction to Python, taught in Year 7, Summer 2. It answers one big question: How can a program remember what the user types?
By the end, pupils can use input to ask the user a question, store the answer in a variable by assignment and use a constant for a value that never changes.
- The Build (the main task)
- Write a program that asks the cook for their name and their recipe, stores each answer in a variable and prints a personal message that uses the constant OVEN_TEMP.
- Support version
- Part-filled code: the constant and the first input line are written; pupils fill the gaps in the second input and the print lines.
- Challenge
- Explain why OVEN_TEMP is a constant but recipe is a variable, using the word store.
- Real-world link
- The recipe helper asks the cook's name and recipe, and keeps the oven temperature as a constant.
- Key words
- Assignment, Constant and Store, each with a definition, an icon and a common mix-up on the key vocabulary slide.
- Misconceptions it tackles
- “= means 'equals' as in maths, so count = count + 1 is impossible”; “When a variable is given a new value, it keeps the old value as well”.
- National Curriculum
- NC3 (two or more languages, at least one textual; data structures; modular programs with procedures or functions); NC4 (boolean logic (AND, OR, NOT) in circuits and programming; binary numbers, addition and conversion).
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 Introduction to Python 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 KS3 Computing
See allPupils learn to write and run a Python program that uses print to output text, and fix syntax errors by reading the error message.
Free sample lessonPupils learn to choose the right data type for a value, convert input to a number and use arithmetic operators to calculate the ingredients for a scaled recipe.
Pupils learn to write an if/else statement with a True or False condition, so a program gives a different outcome for different inputs.
Written for the specifications named. Not endorsed by or affiliated with any exam board.