Explaining data and code structures with comments
A comment beside a variable, list, record or class that says what it stores and how it is used, so other programmers can understand the data and code structures.
Understanding Explaining data and code structures with comments in VCE Applied Computing U1O2
What it does: The comment tells the reader this attribute stores a test mark and that its scale is out of 100. The comment explains the purpose of the loop, so the reader understands how the data structure is being used. Placing the comment next to the variable's declaration helps other programmers understand it as soon as they see it. Comments on records should say what each field stores. Vague wording like 'thing' does not help another programmer. The better comment explains what the attribute represents and its unit. The other one only repeats what the code already shows. The computer ignores comments, but people rely on them. A wrong comment is worse than none because it misleads maintainers.
Common mistakes: Python comments start with #, not //. The // is a syntax error. It should be scores = [] # student marks. The comment is misleading. len(ages) counts how many values are in the list, it does not add them up. The comment should say how many ages.
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 89–124) and word search (Modules 8–124).
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
scores = [] # marks for each studentFill in the Blanks
Spot the Error
Student with a class code? Join your class →