
Pupils who can read code write better code. In this complete 60-minute lesson, pupils learn to trace Python programs line by line, predict exactly what they print, and find and fix bugs. No Python installation is needed: the drill runs in any web browser.
Lesson outline (60 minutes)
- Do now: predict the output of a three-line program
- How Python reads a program: top to bottom, = stores a value, text vs numbers
- Trace tables, modelled step by step
- Three kinds of error: syntax, runtime and logic
- Spot-the-bug and predict-the-output questions, with answers that stay hidden until you click
- The four most common beginner misconceptions
- 18 minutes of practice on the self-marking drill
- Exit ticket: a while loop
What’s included
- slides.html: 12 slides with syntax-highlighted code. Click or press → to reveal each answer.
- slides.pdf: the same slides as a PDF
- lesson-plan.pdf: objectives, curriculum link, key vocabulary, a minute-by-minute plan with what to say, answers and misconceptions
- drill.html: 12 questions. Pupils type the exact output or click the line with the bug. Covers strings, variables, if/else, for loops with range, while loops, // and %, and syntax, runtime and logic errors.
- worksheet.pdf: a paper version of the drill with an answer page
- how-to-use.pdf: opening the files, showing them on the board and sharing with pupils
Every answer is checked by running real Python. The drill also explains each pupil’s specific mistake. A pupil who says “4” + “2” gives 6 is told that quotes make text, so + joins the two strings. A pupil who thinks range(3) gives 1, 2, 3 is told that range starts at 0.
No logins, no installs and no pupil data. Ideal for non-specialists, cover lessons, and the step between block coding and writing Python.
National Curriculum KS3: use two or more programming languages, at least one of which is textual, to solve a variety of computational problems.
Buying for your department? The school licence covers every teacher in your school.
Get this resource as part of a bundle and save up to 20%
A bundle is a package of resources grouped together to teach a particular topic, or a series of lessons, in one place.
Something went wrong, please try again later.
This resource hasn't been reviewed yet
To ensure quality for our reviews, only customers who have purchased this resource can review it
Report this resourceto let us know if it violates our terms and conditions.
Our customer service team will review your report and will be in touch.