Lists: storing many values – Year 9 Computing lesson
Pupils learn to create a list, access and change an item using its index, and find how many items it holds with len().
Lesson 2 of 6 in unit 9.1 Python: Lists and Functions, taught in Year 9, Autumn 1. It answers one big question: How can one variable store a whole list of values?
By the end, pupils can create a list, access and change an item using its index, and find how many items it holds with len().
- The Build (the main task)
- Write a program that stores the games club's top five scores in a list, prints the top score and the fifth score using their indexes, then replaces one score and prints the new list.
- Support version
- Parsons problem: the program's lines are jumbled, with one extra line that uses scores[5] for the fifth score.
- Challenge
- Use len() to print how many scores there are, and use index -1 to print the last score without counting.
- Real-world link
- A leaderboard holds many scores under one name; today pupils store the games club's top five scores in a list.
- Key words
- List, Index and Item, each with a definition, an icon and a common mix-up on the key vocabulary slide.
- Misconceptions it tackles
- “The first item in a list is at index 1”; “Each value in a list needs its own variable name, like score1, score2, score3”.
- 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 allPupils learn to trace a program that uses a loop and nested selection in a trace table, and use it to predict the program's output.
Free sample lessonPupils learn to append items to a list and traverse it with a for loop to print, count or total every item.
Pupils learn to define and call a procedure and a function, and explain that a function returns a value but a procedure does not.
Written for the specifications named. Not endorsed by or affiliated with any exam board.