Building a modular program with functions, lists and classes
A program split into parts: a class for its things, a list of objects, and small functions called from main(), planned with diagrams and checked with tests.
Understanding Building a modular program with functions, lists and classes in ACARA Digital Technologies Years 9–10
What it does: The menu loop in main() repeats with a while loop, calling the right function for each choice. This line creates an object from the Pet class and adds it to the list of objects. Passing the list in as a parameter keeps the function reusable and easy to test on its own. main() is the control centre. The real work is done by small functions that each do one job. Create the object with Pet(...), then use append() to store it in the list. Small functions can be tested one at a time with assert or print(), which pinpoints the problem quickly.
Common mistakes: A class header must end with a colon. It should be class Pet:. Lists have no add() method. Use pets.append(pet) to put the new object on the end of the list.
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 681–707) 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
modular programFill in the Blanks
Spot the Error
Student with a class code? Join your class →