Choose exam board for KS4 Computer Science (GCSE)
Choose exam board for KS4 English
Choose exam board for KS4 French
Choose exam board for KS4 Geography
Choose exam board for KS4 German
Choose exam board for KS4 History
Choose tier for KS4 Maths
Choose exam board for KS4 Music
Choose exam board for KS4 Physical education (GCSE)
Choose exam board for KS4 Religious education (GCSE)
Choose exam board for KS4 Spanish

      Lesson details

      Learning outcome

      I can create a program that uses a function to return values.

      Key learning points

      1. A function is a named block of code that is called to perform a task and will return a value.
      2. A return value is a value that is returned to the calling program.
      3. Arguments are values provided to a subprogram at the time it is called.
      4. Subprogram parameters are values used by the subprogram that are passed from the arguments when it is called.

      Keywords

      • Function - a subprogram that returns a value

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

      • Parameter - used in a subprogram to allow values to be passed into them

      • Argument - values held in the brackets of a subprogram call, which are passed into a subprogram via the parameters

      Common misconception

      When a function returns a value it can be used throughout the program that called it.

      The return value needs to be stored if it is to be used later in the program that calls it.

      Teacher tip

      Draw parallels to functions that pupils have already used such as input(). If the text entered is not stored in a varibale, it cannot be used. Ask pupils to suggest other such examples.

      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 (2026), 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

      6 Questions

      Q1.
      A is a section of code that performs a specific task.

      Correct Answer: subprogram, procedure, function

      Q2.
      What is the correct syntax for defining a procedure in Python?

      procedure my_procedure():
      Correct answer: `def my_procedure():`
      sub my_procedure():

      Q3.
      What is the difference between a procedure and a function?

      There is no difference.
      A procedure returns a value, a function does not.
      Correct answer: A function returns a value, a procedure does not.

      Q4.
      Match the terms to the definitions.

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

      a subprogram that executes a block but does not return a value

      Correct Answer:function,a subprogram that returns a value

      a subprogram that returns a value

      Correct Answer:return value,a value that is returned by a function

      a value that is returned by a function

      Correct Answer:call,an expression that passes control and arguments to a subprogram

      an expression that passes control and arguments to a subprogram

      Q5.
      The values passed to a procedure when it is called are called .

      Correct Answer: Arguments, rguments

      Q6.
      The variables defined inside a procedure are called .

      Correct Answer: parameters, arameters

      6 Questions

      Q1.
      What is the primary purpose of a function in programming?

      to repeat a block of code multiple times
      to store and retrieve data
      to organise code
      Correct answer: to perform a specific task and return a value

      Q2.
      Which keyword is used to define a function in Python?

      func
      function
      Correct answer: def
      define

      Q3.
      What are the values passed to a function called?

      parameters
      variables
      Correct answer: arguments
      constants

      Q4.
      Match the following terms and definitions.

      Correct Answer:function,a named block of code that performs a task and returns a value

      a named block of code that performs a task and returns a value

      Correct Answer:parameters,values used by the function that are passed to it when it is called

      values used by the function that are passed to it when it is called

      Correct Answer:return value,a value that is returned by a function

      a value that is returned by a function

      Correct Answer:arguments,values provided to a function at the time it is called

      values provided to a function at the time it is called

      Q5.
      A function can have __________ parameters.

      only one
      Correct answer: zero, one or more
      no

      Q6.
      The keyword used to send a value back from a function is .

      Correct Answer: return

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