Year 9 (ages 13–14, Grade 8 in the US) · Computing · Python: lists and functions · Lesson 2
Functions
Defining and calling Python functions, parameters, return values, the difference between print and return, and why functions help.
Exam boards: this lesson matches the AQA and Pearson Edexcel GCSE computing courses. Check which course your school follows.

14-minute video lesson
Teaching, worked examples and 20 practice questions solved step by step.
Watch free for a monthWhat your child will learn
- Define a function
- Use parameters
- Return values
- Call functions
The method
- def name(parameters):.
- Indent the body.
- return a value if needed.
- Call it: name(values).
Key words: function, def, parameter, return, call, indent.
Worked examples
Worked examples from the lesson, with every step.
Question 1
What does this code print? (The code is shown below.)
- Step 1: Read the code
Answer: HELLO
Question 2
What does this code print? (The code is shown below.)
- Step 1: Read the code
Answer: 12
Question 3
What does this code print? (The code is shown below.)
- Step 1: Read the code
Answer: 14