A function does not always return a value. In a user-defined function, a return statement is used to return a value.
Example:
Program:
# This function will not return any value
def func1():
a = 5
b = 6
# This function will return the value of 'a' i.e. 5
def func2():
a = 5
return a
# The return type of the functions are stored in the variables
message1 = func1()
message2 = func2()
print("Return from function 1-->", message1)
print("Return from function 2-->", message2)
OUTPUT:
Return from function 1--> None
Return from function 2--> 5