Passing a list into a function
A function header with a list parameter. Pass a list when you call it, like total_of([5, 8, 9]), and the function can loop over or read its items.
Understanding Passing a list into a function in ACARA Digital Technologies Years 9–10
What it does: Because scores is a list parameter, a for loop can visit each item and add it to the running total. Each call passes a different list, so the function works on that list's items each time. Lists are indexed with square brackets. Round brackets would try to call scores like a function. The name in the brackets of the def line is the parameter, and it will hold whatever list the caller passes in.
Common mistakes: A function header must end with a colon. It should be def total_of(scores): so that the indented body belongs to the function. You can't divide a number by a whole list, which causes a TypeError. Divide by the count of items, so it should be return total / count.
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 629–680) and word search (Modules 629–707).
Take this worksheet further — free with Cloodit
Each concept is reinforced from every angle — learned, then applied, then tested.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
def total_of(scores):Fill in the Blanks
Spot the Error
Student with a class code? Join your class →