Skip to content
Menu

Year 9 (ages 13–14, Grade 8 in the US) · Computing · Python: lists and functions · Lesson 3

Functions that process lists

Using built-in list functions, writing functions that total, count and average lists, and validating input with while loops.

Exam boards: this lesson matches the AQA and Pearson Edexcel GCSE computing courses. Check which course your school follows.

Whiteboard video lesson: Functions that process lists

15-minute video lesson

Teaching, worked examples and 20 practice questions solved step by step.

Watch free for a month

What your child will learn

  • Use built-in list functions
  • Write functions that process lists
  • Count and total with loops
  • Validate input

The method

  1. Can a built-in do it? sum, max, min, len.
  2. If not, loop through the list.
  3. Keep a running total or count.
  4. Validate input with a while loop.

Key words: sum, max, min, average, validation, function.

Worked examples

Worked examples from the lesson, with every step.

Question 1

What does this code print? (The code is shown below.)

  1. Step 1: Read the code

Answer: 10

Question 2

What does this code print? (The code is shown below.)

  1. Step 1: Read the code

Answer: 15

Question 3

What does this code print? (The code is shown below.)

  1. Step 1: Read the code

Answer: [1, 3, 5]