Existence checking in code
An existence check tests that a value was actually entered. strip() removes spaces, so this is True for empty or space-only input, and an error message can be shown.
Understanding Existence checking in code in VCE Software Development U3O1
What it does: The existence check detects the missing data and the print() line tells the user what is wrong. Calling strip() on the input turns ' ' into an empty string, so a later comparison with '' will catch it. A comparison needs == (two equals signs). A single = is assignment and causes a syntax error. The error message belongs in the branch where the value IS empty. Using != would show it when data is present. The existence check needs the comparison operator == to test whether the stripped value is empty.
Common mistakes: This branch runs when the name is empty, so it should show a missing-data message such as print('Name is required'), not a welcome that uses the empty value. The else keyword must be followed by a colon. It should be else:.
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 114–124) and word search (Modules 114–141).
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
if value.strip() == '':Fill in the Blanks
Spot the Error
Student with a class code? Join your class →