0
return
what is RETURN on python? i can not understand it.
4 Answers
+ 5
A function is made to do some task and then it "returns" the result. For example the add() function:
def add(x, y):
sum = x + y # the summation task
return sum # will return the sum
print(add(5, 7)) # will print the "return" value i.e., 12
+ 3
THNAKS
+ 3
I want add that its NOT necessary that an function return something (though in python in this case return None special value)