Runtime error: type mismatch
A runtime error when an operation gets the wrong data types, like '5' + 3 (string plus integer). Fix it by converting with int() or str(), e.g. int(input()).
Understanding Runtime error: type mismatch in VCE Software Development U3O1
What it does: Wrapping input() in int() makes the value a number, so adding 1 avoids a TypeError. str(10) gives the string '10', so both sides of + are strings and the TypeError is avoided. '5' is a string and 3 is an integer. Python will not mix them with +, so it raises a TypeError at runtime. int() turns the typed text into a whole number so you can do maths with it. str() keeps it as text, so the error remains. The code '5' + 3 is valid syntax. Python only discovers the mismatch when it tries to run that line, so it is a runtime error.
Common mistakes: age is an integer, but str(years) is a string. Adding an int to a str raises a TypeError. Both values must be numbers: total = age + years. name is a string and score is an integer, so + causes a TypeError. Convert the number with str(): msg = name + str(score).
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
TypeErrorFill in the Blanks
Spot the Error
Student with a class code? Join your class →