The Python return
keyword allows you to define the return value of a function (e.g., return X
). If you don’t explicitly set a return value or you omit the return
statement, Python will implicitly return the following default value: None
.

There are three cases of what a function can return:
- Case 1: The function has a
return
statement that returns an explicit value. - Case 2: The function has a
return
statement that returns explicitly nothing. It returnsNone
. - Case 3: The function does not have a
return
statement. The function in that case implicitly returnsNone
.
Let’s have an example of all three cases next!
Case 1: The function has a return
statement that returns an explicit value.
def f1(): return 42 print(f1()) # 42
Case 2: The function has a return
statement that returns explicitly nothing. It returns None
.
def f2(): return print(f2()) # None
Case 3: The function does not have a return
statement. The function in that case implicitly returns None
.
def f3(): pass print(f3()) # None
Feel free to check out our Python cheat sheets to learn about all the Python basics and keywords and tricks:

While working as a researcher in distributed systems, Dr. Christian Mayer found his love for teaching computer science students.
To help students reach higher levels of Python success, he founded the programming education website Finxter.com that has taught exponential skills to millions of coders worldwide. He’s the author of the best-selling programming books Python One-Liners (NoStarch 2020), The Art of Clean Code (NoStarch 2022), and The Book of Dash (NoStarch 2022). Chris also coauthored the Coffee Break Python series of self-published books. He’s a computer science enthusiast, freelancer, and owner of one of the top 10 largest Python blogs worldwide.
His passions are writing, reading, and coding. But his greatest passion is to serve aspiring coders through Finxter and help them to boost their skills. You can join his free email academy here.