New
New
Lesson 2 of 6
  • Year 10
  • OCR

Procedures in programs

I can create and call a procedure in a program.

Lesson 2 of 6
New
New
  • Year 10
  • OCR

Procedures in programs

I can create and call a procedure in a program.

These resources were made for remote use during the pandemic, not classroom teaching.

Switch to our new teaching resources now - designed by teachers and leading subject experts, and tested in classrooms.

Lesson details

Key learning points

  1. A procedure is a named block of code that performs a specific task.
  2. Procedures are designed to run a sequence of code that does not return any value to the calling program.
  3. In order to run a procedure, it must be called by the main program.

Keywords

  • Call - an expression that passes control and arguments (if any) to a subprogram

  • Procedure - a subprogram that executes a block of code when called but does not return a value

  • Function - a subprogram that returns a value

  • Return value - a value that is returned by a function

Common misconception

Functions and procedures are just different names for the same thing.

A function is a type of subprogram that returns a value whereas a procedure is a type of subprogram that does not return a value.


To help you plan your year 10 computer science lesson on: Procedures in programs, download all teaching resources for free and adapt to suit your pupils' needs...

print() is an example of a procedure whereas input() is an example of a function. Ask pupils to explain why.
Teacher tip

Equipment

Pupils will need access to a device that can edit and run Python programs. Examples in this lesson use the RPF Code Editor https://oak.link/python-editor

Licence

This content is © Oak National Academy Limited (2025), licensed on Open Government Licence version 3.0 except where otherwise stated. See Oak's terms & conditions (Collection 2).

Lesson video

Loading...

Prior knowledge starter quiz

Download quiz pdf

6 Questions

Q1.
What is the term used for the name of a subprogram?

Correct answer: identifier
variable
parameter
interface

Q2.
In this code:
1
def num_walks(total_dogs, total_days):
total_dogs and total_days are:
Code colour

When programmers write code, they use a special tool called an IDE (Integrated Development Environment). In an IDE, different colours are used to help programmers understand the code:


  • • Blue - numbers and boolean values
  • • Green - strings
  • • Purple - keywords

identifers
variables
Correct answer: parameters
return values

Q3.
A chart is created to decide the hierarchy for a program.

Correct Answer: structure

Q4.
A subprogram interface is made up of which items?

Correct answer: identifier
Correct answer: parameters
variables
Correct answer: return values
boundaries

Q5.
Select the statement that is true.

If a subprogram is defined, then it must be executed in the program.
Subprograms are always designed to perform multiple tasks.
Correct answer: Subprograms make programs easier to read and understand.

Q6.
What code is missing from the program?
123456
___ multiply_two_numbers(number1, number2) answer = number1 * number2 return answer result = multiply_two_numbers(5,5) print(result)
Code colour

When programmers write code, they use a special tool called an IDE (Integrated Development Environment). In an IDE, different colours are used to help programmers understand the code:


  • • Blue - numbers and boolean values
  • • Green - strings
  • • Purple - keywords

Correct Answer: def

Assessment exit quiz

Download quiz pdf

5 Questions

Q1.
Match the term to the definition.

Correct Answer:parameter,used in a subprogram to allow values to be passed into it

used in a subprogram to allow values to be passed into it

Correct Answer:function,a subprogram that returns a value

a subprogram that returns a value

Correct Answer:procedure,a subprogram that does not return a value

a subprogram that does not return a value

Correct Answer:subprogram,a sequence of instructions to perform a specific task

a sequence of instructions to perform a specific task

Q2.
are used in subprogram to allow values to be passed into them.

Correct Answer: parameters, arameters

Q3.
are the values held in the brackets of a subprogram call.

Correct Answer: arguments, rguments

Q4.
This code is an example of:
12345
def calculate(a, b): answer = a + b return answer answer = calculate(5, 10)
Code colour

When programmers write code, they use a special tool called an IDE (Integrated Development Environment). In an IDE, different colours are used to help programmers understand the code:


  • • Blue - numbers and boolean values
  • • Green - strings
  • • Purple - keywords

a procedure
Correct answer: a function
iteration
selection

Q5.
What keyword is used to define a subprogram in Python?

Correct answer: def
sub
input
print