Reading an error message and traceback
The start of Python's error report. It names the error type (like NameError) and the line number where it happened, so you know where to start looking for the bug.
Understanding Reading an error message and traceback in VCE Software Development U3O1
What it does: The error type names the problem: the index used was bigger than the last position in the list. The traceback names TypeError and explains that a string and an integer cannot be joined with +. A NameError means a variable or function name is used before it exists. Check line 7 for a typo or a missing assignment. The closing bracket is missing, so Python cannot read the line. Broken grammar in code is a SyntaxError. total has not been given a value, so Python does not know the name. That is a NameError. List positions start at 0, so the valid indexes are 0, 1 and 2. Index 3 is out of range, which is an IndexError.
Common mistakes: The traceback would say NameError: name 'bonnus' is not defined, on line 3. The variable is spelled bonus, so the line should be total = score + bonus. A SyntaxError is reported on line 1 because the colon at the end of the for line is missing. It should be for i in range(3):.
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 156–166) and word search (Modules 142–166).
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
Traceback (most recent call last):Fill in the Blanks
Spot the Error
Student with a class code? Join your class →