Constants
A constant: a named value set once and never changed while the program runs. Written in UPPER_CASE by convention, it replaces magic numbers and is easy to update in one place.
Understanding Constants in VCE Software Development U3O1
What it does: The 0.1 is a magic number because nobody can tell what it means. Replacing it with GST_RATE would fix this. The score variable is reassigned as the program runs. A constant such as GST_RATE is never reassigned after it is defined. By convention, constants are written in UPPER_CASE with underscores between words, so GST_RATE stands out as a value that should not change. Defining constants at the top makes them easy to find and change in one place. With a constant, one edit at the top of the program updates every line that uses it. Magic numbers must be hunted down one by one.
Common mistakes: This adds the rate (0.1) to the price instead of the GST amount. It should be total = price + gst. The constant was defined as MAX_ITEMS in upper case. Python is case-sensitive, so max_items causes a NameError. It should be MAX_ITEMS.
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 10–47) and word search (Modules 10–71).
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
GST_RATE = 0.1Fill in the Blanks
Spot the Error
Student with a class code? Join your class →