Single lesson · Key Stage 3

Looping through lists – Year 9 Computing lesson

Pupils learn to append items to a list and traverse it with a for loop to print, count or total every item.

Also in a bundle Python: Lists and Functions – Year 9 Computing lessons 6 lessons for £20 · save 16% on buying separately

Lesson 3 of 6 in unit 9.1 Python: Lists and Functions, taught in Year 9, Autumn 1. It answers one big question: How can a program visit every item in a list?

By the end, pupils can append items to a list and traverse it with a for loop to print, count or total every item.

The Build (the main task)
Write a program that asks for four new game scores, appends each one to a list, then traverses the list to print every score and the total.
Support version
Part-filled code: the loops are given, with gaps for the append line and the line that adds each score to the total.
Challenge
Traverse the list again to find the highest score without using max(), and print how many scores are over 50.
Real-world link
Each new game adds a score to the end of the leaderboard, and the app works out totals by visiting every score in turn.
Key words
Traversal, Append and Access, each with a definition, an icon and a common mix-up on the key vocabulary slide.
Misconceptions it tackles
“In for score in scores:, score is the position number of each item”; “append can add an item at any position, such as the start of the list”.
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
Lists and Functions 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.