Modifying an existing program
Read and trace the code first to see what it does, then change one small part at a time and re-run your test cases to check the effect of that change.
Understanding Modifying an existing program in VCE Software Development U3O1
What it does: Editing a single value means that if the output changes or breaks, you know exactly which change caused it. A comment written after reading and tracing the code records what it does, so you can edit it safely. Even a small change can break something else. Re-running your test cases shows whether the program still works. Making one change at a time keeps cause and effect clear. With two changes, either one might be the culprit.
Common mistakes: The change was meant to ADD 10% GST, so add_gst(100) should give 110. Subtracting gives 90. It should be 'return price + gst'. Re-run the test case after each change to catch this. A running total must start at 0. Starting at 1 makes every result too big by 1. It should be 'total = 0'. Tracing the code by hand would show this.
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 178–193) and word search (Modules 168–193).
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
modify codeFill in the Blanks
Spot the Error
Student with a class code? Join your class →