Choosing data types for input, storage and output
input() always returns a str, so convert it (e.g. with int) to store it as a number. Turn it back into text with str() or an f-string when you output it.
Understanding Choosing data types for input, storage and output in VCE Software Development U4O1
What it does: float() converts the str returned by input() into a number that can be stored and used in calculations. str() converts the stored int to text, so it can be joined with a string for output. Without conversion, age holds the text '25'. You must write int(input('Age: ')) to store a whole number. int() would cause a ValueError for '4.95' (and cannot hold cents). Use float() for decimal values. A bool holds True or False and can be used directly in conditions. The string 'True' is just text, and any non-empty string is treated as true. Adding two strings concatenates them. Convert with int() first to get 8.
Common mistakes: age was converted to an int on line 2, so adding the str "1" causes a TypeError. It should be age + 1, with both values numbers. total is a float, and you can't join a float to a str with +. Convert it to text with str(total) or use an f-string.
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 3–79) and word search (Modules 3–114).
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
int(input())Fill in the Blanks
Spot the Error
Student with a class code? Join your class →