Single lesson · Key Stage 3

Procedures and functions – Year 9 Computing lesson

Pupils learn to define and call a procedure and a function, and explain that a function returns a value but a procedure does not.

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

Lesson 4 of 6 in unit 9.1 Python: Lists and Functions, taught in Year 9, Autumn 1. It answers one big question: Why do programmers split programs into named subprograms?

By the end, pupils can define and call a procedure and a function, and explain that a function returns a value but a procedure does not.

The Build (the main task)
Write a procedure show_menu() that prints the leaderboard's menu and a function get_score() that asks for a score and returns it as an integer, then call each one from the main program.
Support version
Parsons problem: the lines of both subprograms and the main program are jumbled, with one extra line that defines get_score without brackets.
Challenge
Reuse get_score() three times in a loop, appending each returned score to a list, and explain why this is better than copying the code.
Real-world link
Apps reuse the same small jobs, such as showing a menu or reading a score, many times; today the leaderboard gets its first subprograms.
Key words
Procedure, Function and Reuse, each with a definition, an icon and a common mix-up on the key vocabulary slide.
Misconceptions it tackles
“Defining a subprogram with def runs its code straight away”; “A procedure gives back a value that can be stored, like choice = show_menu()”.
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.