← Python

Functions – Return Values

return sends a value back from a function to the caller

What it does: The returned value is stored in 'result'. result = 10. Functions can return booleans. n % 2 == 0 is True when n is even. return passes a value out of the function — print only displays it. add() returns 3+5=8, which is stored in result. double(5) returns 5*2=10, then print() displays it. A returned value can be used anywhere a value is expected. return immediately exits the function — any code after it is unreachable. 4 % 2 = 0, so 0 == 0 is True.

Common mistakes: Using print instead of return: result will be None because print doesn't send back a value. Code after return never runs: move print before return.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a journey and assign it to your class.

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
What does return do?
Sends a value back to the callerPrints a value
Matches
❌ def double(n): return n * 2 print('done')
Error: Code after return unreachable
Applying
Meanings
Term
return
Meaning
Sends a value back to the code that called the function.
Practice
def add(a, b):
Testing
Gaps
a + b
Check Answer
Spots
1def add(a, b):
2 print(a + b)

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Giant Isopod' badge — Patient Builder, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. What does return do?
A. Sends a value back to the caller ✓
B. Prints a value
return passes a value out of the function — print only displays it
2. def add(a, b):\n return a + b\nresult = add(3, 5)\nWhat is result?
A. None
B. 8 ✓
add() returns 3+5=8, which is stored in result
3. What's the difference between return and print?
A. return sends data back, print only displays ✓
B. They are the same
print is for display only — return gives the value back to be used
4. What does a function return if there's no return statement?
A. 0
B. None ✓
Python functions return None by default when there's no return statement
5. def double(n):\n return n * 2\nprint(double(5))\nWhat prints?
A. 10 ✓
B. 5
double(5) returns 5*2=10, then print() displays it

Match the Pairs

def double(n): return n * 2 print('done') Error: Code after return unreachable
def greet(): print('Hi') result = greet() print(result + '!') Error: greet() returns None
def double(n): return n * 2 result = double(5) Valid: result stores 10
def is_even(n): return n % 2 == 0 Ok: Returns True or False
def double(n): return n * 2 print(double(4)) Output: 8
def hi(): print('Hello') print(hi()) Output: Hello None

Key Term

return
Sends a value back to the code that called the function.~~Return value

Fill in the Blanks

1. def add(a, b): return a + b result = add(3, 5)
2. def double(n): return n * 2 print(double(5))
3. def square(n): return n ** 2
4. def greet(name): return 'Hello ' + name msg = greet('Al')
5. def is_even(n): return n % 2 == 0

Spot the Error

Question 1
A def add(a, b):
B print(a + b)
C
D result = add(3, 5)
E print(result)
Line B — Using print instead of return: result will be None because print doesn't send back a value
Question 2
A def double(n):
B result = n * 2
C return result
D print('Done')
E print(double(5))
Line D — Code after return never runs: move print before return
Question 3
A def add(a, b):
B total = a + b
C return total
D print('Adding...')
E print(add(3, 5))
Line C — return must be indented inside the function
Question 4
A def add(a, b):
B total = a + b
C Return total
D print('Adding...')
E print(add(3, 5))
Line C — return must be lowercase: Return is not valid Python
Question 5
A def double(n):
B result = n * 2
C return(result)
D print('Done')
E print(double(5))
Line C — return is a keyword, not a function: parentheses are unnecessary (but this technically works)
For Teachers

Create a free class, add this module to a journey, and track who's stuck.

Create a free teacher account →

No credit card. No setup fee. Make a class and invite students in under three minutes.

For Students

Practice this topic interactively, track progress, and unlock badges.

Start Learning Free →

Have a class code?