Optimising code with AI tools
Re-running the same test cases on AI-optimised code to prove it still gives identical results as before. If any result changes, reject the change.
Understanding Optimising code with AI tools in VCE Software Development U3O1
What it does: Comparing the output of the original and optimised functions on the same data shows whether behaviour was preserved. True means it matches. Looping over the existing test cases and asserting the new function gives each expected result is a regression test of the optimised code. A good prompt names the goal (efficiency), sets the rule (same output) and asks for an explanation so you can review the changes. To compare fairly, both versions must use the same test cases. Otherwise you cannot show the behaviour is unchanged. Breaking behaviour is the key reason to reject a change. Different names alone do not change what the code does.
Common mistakes: A single = assigns a value and is invalid in an assert. The regression test must compare the old and new results with ==: assert old == new. A for loop header must end with a colon. It should be: for c in cases:. This loop re-runs every test case on both versions.
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
regression testFill in the Blanks
Spot the Error
Student with a class code? Join your class →