Testing a program that uses input()
Pauses a program so you can type a test value; it returns text. Test by typing each planned input in order, then compare the printed output with the expected result.
Understanding Testing a program that uses input() in ACARA Digital Technologies Years 9–10
What it does: The test case lists the inputs in order (4 first, then 5) so each run can be repeated and compared with the expected output of 20. int() converts the text returned by input() into a whole number so the program can calculate with the test value. Because input() returns text, + joins the strings "4" and "4" to make "44". Your expected output must allow for this.
Common mistakes: input() returns text, so a + b joins the strings. Typing 2 then 3 prints 23 instead of the expected 5. Convert with int(a) + int(b). passed has no quotes, so Python looks for a variable called passed and gives a NameError. The text must be in quotes: "passed".
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 591–622) and word search (Modules 536–622).
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
input()Fill in the Blanks
Spot the Error
Student with a class code? Join your class →