← VCE Software Development U4O1

Built-in functions sum(), min() and max()

Built-in functions that return the total, smallest and largest value in a list, replacing a hand-written loop with one short, clear line of code.

Understanding Built-in functions sum(), min() and max() in VCE Software Development U4O1

What it does: max(list) returns the biggest value in the list, so no loop or comparison variable is needed. sum(scores) gives the total and len(scores) gives how many values there are, so dividing them gives the average in one line. sum() is the built-in function that adds up every value in a list. Python has no built-in called add() for this. Passing separate numbers causes a TypeError because sum() expects one iterable such as a list, so the values must be wrapped in square brackets.

Common mistakes: Python is case-sensitive, so Sum is not the built-in function. It should be sum(marks) in lowercase. The list opens with [ but closes with ), which is a syntax error. It should close with ].

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 82–114) and word search (Modules 3–114).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Which line gives the total of all the values in the list marks?
total = add(marks)total = sum(marks)
Matches
total = sum(10, 20, 30)
↓
sum() needs a single list (or other iterable) as its argument, not separate numbers. It should be sum([10, 20, 30]).
Applying
Meanings
Term
sum(), min(), max()
Meaning
Built-in functions that return the total, smallest and largest value in a list, replacing a hand-written loop with one short, clear line of code.
Practice
scores = [72, 85, 64, 91, 78]
Testing
Gaps
total = (scores)
Check Answer
Spots
1marks = [72, 88, 65, 90]
2total = Sum(marks)

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Blobfish' badge — Pressure Handler, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Which line gives the total of all the values in the list marks?
A. total = sum(marks) ✓
B. total = add(marks)
sum() is the built-in function that adds up every value in a list. Python has no built-in called add() for this.
2. Which line finds the smallest value in the list scores?
A. lowest = smallest(scores)
B. lowest = min(scores) ✓
min() is the built-in function that returns the smallest value in a list. smallest() does not exist in Python.
3. Which line finds the largest value in the list scores?
A. highest = max(scores) ✓
B. highest = largest(scores)
max() returns the largest value in a list. largest() is not a Python function.
4. For the list [4, 9, 2], what does sum() return?
A. 15 ✓
B. 9
sum() adds every value together: 4 + 9 + 2 = 15. The value 9 is what max() would return.
5. Why is total = sum(prices) often better than a for loop with a running total?
A. It lets you add values that are not in a list
B. It is shorter and clearer, with less code to get wrong ✓
Built-in functions replace a hand-written loop with one clear line, so there is less code to read, maintain and make mistakes in. They still work on a collection of values such as a list.

Match the Pairs

total = sum(scores) → Adds up every number in the list scores and stores the total, with no loop needed
lowest = min(scores) → Finds the smallest value in the list scores and stores it in lowest
Find the largest value in a list in one line instead of writing a loop → highest = max(scores)
Calculate an average by combining sum() with len() → average = sum(scores) / len(scores)
total = sum(10, 20, 30) → sum() needs a single list (or other iterable) as its argument, not separate numbers. It should be sum([10, 20, 30]).
smallest = min[scores] → Square brackets were used instead of round brackets. A function call needs min(scores).

Key Term

sum(), min(), max()
Built-in functions that return the total, smallest and largest value in a list, replacing a hand-written loop with one short, clear line of code.

Fill in the Blanks

1. scores = [72, 85, 90, 64] total = sum(scores)
Hint: Type the built-in function that adds up every value in a list, replacing a loop with a running total.
2. scores = [72, 85, 90, 64] lowest = min(scores)
Hint: Type the built-in function that returns the smallest value in the list.
3. scores = [72, 85, 90, 64] highest = max(scores)
Hint: Type the built-in function that returns the largest value in the list.
4. prices = [4.5, 12, 7.25] print("Total:", sum(prices))
Hint: Type the name of the list variable that sum() should add up.
5. temps = [18, 24, 31, 22] spread = max(temps) - min(temps)
Hint: Type the arithmetic operator that finds the difference between the largest and smallest values.

Spot the Error

Question 1
A marks = [72, 88, 65, 90]
B total = Sum(marks)
C print(total)
Line B — Python is case-sensitive, so Sum is not the built-in function. It should be sum(marks) in lowercase.
Question 2
A scores = [14, 9, 21, 17)
B lowest = min(scores)
C print(lowest)
Line A — The list opens with [ but closes with ), which is a syntax error. It should close with ].
Question 3
A temps = [18 25 31 22]
B hottest = max(temps)
C print(hottest)
Line A — List items must be separated by commas. It should be [18, 25, 31, 22].
Question 4
A points = [5, 8, 3, 9]
B total = sum(points)
C count = len(points)
D average = total * count
E print(average)
Line D — An average is the total divided by the count, not multiplied. It should be total / count.
Question 5
A data = [12, 7, 19, 4]
B biggest = max(data)
C smallest = min(data)
D spread = smallest - biggest
E print(spread)
Line D — The spread is the largest value minus the smallest. The subtraction is reversed and gives a negative number. It should be biggest - smallest.

Student with a class code? Join your class →