The return Statement in Python is used to return a value from a particular function (method) and hence used to end the execution of a program. We can return values from a function to the calling function with the help of return keyword in Python.
Syntax
return x
In the above syntax, variable ‘x’ is returned to the calling function. Variable ‘x’ can be an integer, string, boolean, list, tuple or anything.
return
In the above syntax, the return statement is without any expression, in this case, a special value called None is returned.
Returning Results from a Function
return x # returns value of x
return 1 # returns 100
return lst # returns list
return x, y, z # returns 3 values
The None keyword is used to define a null value. None is not the same as 0, false, or an empty string.
Program : To code a function that returns the multiplication of two integers.
# function to return the multiplication of two numbers
def multiply(a, b):
mul = a * b
# now since we have calculated the result we just need to return this value back
return mul
# calling the multiply() function and printing the result
result = multiply(3, 5)
print("Multiplication of the numbers is : ", result)

#facts_about_return_statement
- In Python, return is treated as a keyword.
- In Python, we can return multiple values in the form of int, float, str, list, tuple, set, dictionary etc.
- In Python, we can even return a function itself.
- return statement should be used inside function/ method.
- return statement can be inside if-else statements as well.
- return statement can also include expression, in such cases expression is first evaluated then returned.
- A function can not return values two times within a same function. In such cases, one first return statement is entertained, while the second one is ignored.
That’s all about return statement in Python.
