0
What is return in python plz tell me in simple and easy words with an easy example
2 Answers
+ 1
Simple and easy words. It returns a value to whatever called the function. Example: You asked me a question and I returned an answer to you. Now you can use that answer.
0
If you want to print a number for example, you can put the number into the parantheses OR you could put a variable into them. If you have a function which calculates the sum of two numbers, you may want to print it. Return returns a value which could be used instead of a variable:
def func (x, y):
return x + y
print (func (5, 3))
#8