0
Return 1 what is it
3 Antworten
+ 2
@Dinesh is helpful
+ 2
well basically return means that's the value that function passes, not to be confused with what the function prints or does. example :
def func() : # defining a function
print("hey dude")
return 1
func() # prints "hey dude"
a = func()
print(a) # prints 1
########################
so it doesn't matter what a function does, return means that it passes that value to any variable or function that "calls" it. As I did in this code i pass func() to a, so the value func() returned is passed to a which is 1, so printing a will print 1. if you returned 599 then it will print 599, return statement is used at the end of function to signify its end as anything written after the return line in the function doesn't get executed. :)
0
return 1 means a that function has output of value 1
ex:
def function() :
return 1
print(function()) //output = 1