+ 1
What is the use of return in python?
2 Answers
+ 2
any function returns something
built in functions also..do (by deault)
so if u creat a function...
after calculatiom
u can return smthing by return keyword..
def function(a,b) :
c= a+b
return c
now if u print....
print( function(9,7))
>>> 16
you can return any datatype....
and moreover more than 1 data type
def function(a,b) :
c= a+b
d=a-b
return c,d
print( function(9,7))
>>>( 16,2 )
0
to return a value.