Functions and procedures – OCR A Level Computer Science lesson (H446)
Students learn to write functions and procedures with parameters in Python and OCR pseudocode and explain the benefits of a modular program.
Lesson 10 of 16 in unit 12.2 Programming Foundations and Computational Thinking, taught in Year 12, Autumn 1. It answers one big question: When should a subroutine return a value?
By the end, students can write functions and procedures with parameters in Python and OCR pseudocode and explain the benefits of a modular program.
- The Build (the main task)
- Write a function hireCharge(minutes, isEbike) that returns the charge for a Fernbridge CycleShare hire, and a procedure printReceipt(code, minutes, isEbike) that calls it and outputs a receipt, in OCR pseudocode and Python (8 marks).
- Support version
- The two headers and the endfunction and endprocedure lines are given; the body lines are a Parsons problem.
- Challenge
- Explain two benefits of the modular design to Fernbridge when its prices change next year.
- Real-world link
- Fernbridge CycleShare prints a receipt for every hire at the docking station.
- Key words
- Function, Procedure and Modular, each with a definition, an icon and a common mix-up on the key vocabulary slide.
- Misconceptions it tackles
- “A function that prints its answer has returned it”; “A procedure can be used inside an expression, like a function”.
- OCR H446 specification
- 2.2.1 (d).
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.
Students need computers for the main task.
Also sold in the Programming Foundations and Computational Thinking unit bundle, which includes the medium term plan, and in the full-year and complete-course bundles.
An independent resource written for OCR A Level Computer Science (H446). It is not endorsed by OCR or Cambridge University Press & Assessment. Programming project (NEA) lessons teach general skills on a made-up example project and give supervised time, within JCQ's rules on the help a centre may give.
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 A Level Computer Science
See allStudents learn to name the debugging tools in their IDE and write a short algorithm in both Python and OCR exam pseudocode.
Free sample lessonStudents learn to identify sequence, selection and iteration in code, and choose between IF, ELSEIF and SWITCH for a task.
Students learn to choose the correct primitive data type for each item of data and use casting to convert between types.
Written for the specifications named. Not endorsed by or affiliated with any exam board.