# The return Statement in Python

PythonServer Side ProgrammingProgramming

The statement return [expression] exits a function, optionally passing back an expression to the caller. A return statement with no arguments is the same as return None.

## Example

All the above examples are not returning any value. You can return a value from a function as follows −

Live Demo

#!/usr/bin/python
Function definition is here
def sum( arg1, arg2 ):
# Add both the parameters and return them."
total = arg1 + arg2
print "Inside the function : ", total
print "Outside the function : ", total
Inside the function : 30
Outside the function : 30