Single lesson · Key Stage 3

Parameters, return values and a modular program – Year 9 Computing lesson

Pupils learn to write functions that take parameters and return values, and combine them into a modular leaderboard program.

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

Lesson 5 of 6 in unit 9.1 Python: Lists and Functions, taught in Year 9, Autumn 1. It answers one big question: How do functions pass data around a modular program?

By the end, pupils can write functions that take parameters and return values, and combine them into a modular leaderboard program.

The Build (the main task)
Write a function highest(scores) that takes a list of scores as a parameter and returns the highest score, then call it from the main program and print the result.
Support version
Part-filled code: the def line and the loop are given, with gaps for the comparison, the return line and the call.
Challenge
Write a second function average(scores) that returns the mean score, and a procedure show_results(name, score) with two parameters.
Real-world link
The games club's leaderboard is finished as a modular program: each function does one job, so it can be tested and swapped on its own.
Key words
Parameter, Return value and Modular, each with a definition, an icon and a common mix-up on the key vocabulary slide.
Misconceptions it tackles
“Printing a value inside a function sends it back to the code that called it”; “The variable passed into a function must have the same name as the parameter”.
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)
  • Parameters return values and a modular program - Quiz Quiz Trade Cards
  • 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.