What is the Python return statement?

Key takeaways:

  • The return statement delivers function results. Without return, a function performs its task but does not send back a result, similar to a chef preparing food but not serving it.

  • Every function returns something. If no return statement is used, Python automatically returns None.

  • return can send multiple values. Unlike some other languages, Python allows returning multiple values as tuples.

  • return can exit a function early. A function stops executing as soon as it encounters a return statement.

  • Using return makes functions reusable and efficient. It enables further data processing, making Python functions more useful and flexible.

Assume you are a chef in a kitchen. You prepare a delicious meal, but instead of serving it to the customer, you just leave it on the counter and walk away. The customer never gets their food!

That’s exactly what happens if you don’t use return in a function. The function does its job, but if it doesn’t return anything, the result is lost. The return statement is like the waiter who takes the meal from the kitchen and delivers it to the customer.

Without return, a function is just doing work without giving you the result. That’s like solving a math problem but never writing down the answer! So, if we want our functions to actually produce useful results, we need return.

Syntax of the return statement

def function_name():
return value
  • function_name is the name of the function.

  • return value specifies what the function will send back when called.

How does the return statement work

Every function in Python returns a value, even if no explicit return statement is provided. If a function does not have a return statement, it automatically returns None.

def greet():
print("Hello!")
result = greet()
print(result) # Output: None

Since there is no return statement, the function implicitly returns None. Now, let’s use the return statement.

A return statement consists of the return keyword followed by an expression or value.

def test_func():
a = 10 + 1
return a
print(test_func());

Every function in Python returns something. A function without a return statement returns None. Something similar can be said about functions that contain a return statement ​but no return value​.

def test_func(): #Function without return statement
a = 10
b = 4
c = a + b
def test_func2(): #Function without return value
a = 10
return
print(test_func())
print(test_func2())

Returning multiple values

Python enables returning multiple values as a tuple, list, or dictionary. This feature is particularly useful when a function needs to provide multiple pieces of related information.

def test_func():
a = 10 + 1
b = "eleven"
return a, b
x, y = test_func()
print(x)
print(y)

Using return to exit a function early

We can use return to stop a function before it completes.

def check_age(age):
if age < 18:
return "You are underage."
return "You are an adult."
print(check_age(16)) # Output: You are underage.
print(check_age(21)) # Output: You are an adult.

Become a Python developer with our comprehensive learning path!

Ready to kickstart your career as a Python Developer? Our “Become a Python Developer” path is designed to take you from your first line of code to landing your first job. This comprehensive journey offers essential knowledge, hands-on practice, interview preparation, and a mock interview, ensuring you gain practical, real-world coding skills. With our AI mentor by your side, you’ll overcome challenges with personalized support, building the confidence needed to excel in the tech industry.

Conclusion

The return statement is a fundamental part of Python functions. It allows functions to send values back to the caller, making them reusable and efficient. Without return, functions can only perform actions but cannot pass back data for further processing.

Frequently asked questions

Haven’t found what you were looking for? Contact Us


What is the `return` statement?

The return statement in Python is used to send a value from a function back to the caller, ending the function’s execution.


What does `get()` return in Python?

The get() method in dictionaries returns the value for a given key if it exists; otherwise, it returns a default value (or None if not specified).


What is the return symbol in Python?

Python uses the return keyword to specify the value a function should return.


What does `return all` do in Python?

Python does not have a built-in return all statement, but a function can return multiple values using tuples, lists, or dictionaries.


Why do we use `return`?

The return statement allows functions to pass computed values back to the caller, enabling reuse and further processing.


Does `return` print in Python?

No, return does not print anything. It only sends a value back to the caller, while print() method displays output to the console.


Free Resources

Copyright ©2026 Educative, Inc. All rights reserved