Single lesson · Key Stage 3

Recap: input, variables and if – Year 8 Computing lesson

Pupils learn to use input, variables and if/else, and cast input to an integer so a program can compare and calculate with numbers.

Also in a bundle Python: Iteration and Boolean Operators – Year 8 Computing lessons 6 lessons for £20 · save 16% on buying separately

Lesson 1 of 6 in unit 8.1 Python: Iteration and Boolean Operators, taught in Year 8, Autumn 1. It answers one big question: Why does Python need to know what type our data is?

By the end, pupils can use input, variables and if/else, and cast input to an integer so a program can compare and calculate with numbers.

The Build (the main task)
Write a sign-up program that asks for a username and an age, casts the age to an integer and uses if/else to say whether the user is old enough (13 or over) to make an account.
Support version
Part-filled code: the input lines and the if/else are given with gaps for the int() cast, the comparison and the two messages.
Challenge
Explain why print("Hello " + age) crashes when age is an integer, and fix it with str().
Real-world link
Every sign-up page checks the details you type, such as whether you are old enough; today's program checks a new user's age before they make a password.
Key words
Casting, String and Convert, each with a definition, an icon and a common mix-up on the key vocabulary slide.
Misconceptions it tackles
“If the user types digits, input() gives Python a number”; “"5" + "5" gives 10”.
National Curriculum
NC3 (two or more languages, at least one textual; data structures; modular programs with procedures or functions).

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 Python
Iteration and Boolean Operators 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 all

Written for the specifications named. Not endorsed by or affiliated with any exam board.