Functions that return True or False (Python)
Calls a function that returns True or False and uses that result directly as the if condition. You do not need to write == True. It can also be combined with not, and, or.
Understanding Functions that return True or False (Python) in ACARA Digital Technologies Years 9–10
What it does: age >= 18 already evaluates to True or False, so returning it directly is the simplest way to write the function. Each call gives True or False, so and and not can join them just like ordinary Boolean values. not goes before the function call. Writing it after is a syntax error. A Boolean function must return its value so that if or while can test the result of the call.
Common mistakes: A single = assigns a value and is not allowed inside a return comparison. Use == to compare: return n % 2 == 0. An if statement must end with a colon, even when its condition is a function call that returns True or False. It should be if is_adult(age):.
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 629–680) and word search (Modules 629–707).
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
if not is_even(7): do?Match the Pairs
Key Term
if is_even(n):Fill in the Blanks
Spot the Error
Student with a class code? Join your class →