Return has two functions:
1. Used to return the run result of a function, or to call another function. such as the Max () function
>>> def fun (A, B):
2. The sign of the end of the function. As soon as the return is run, the function is forced to end. The program after return will not be executed.
>>> def fun (A, B): Return (' Don't run the following statement! ') #函数不在往下运行. If A>b:print (a) >>> fun (8,1) #运行到 return, do not run behind the IF statement ' do not run behind the statement, so far! ' >>> >>> def fun (A, B):
If the function does not write a return, in fact the function runs at the end of the default execution of return None.
>>> def fun (A, b): #这里的return返回函数结果return (A, b) >>> a = Fun (+) >>> print (a) # Verify returned results (1, 2) >>> def fun (A, b): #这个函数里面就没有 Returnprint (A, b) >>> a = Fun (5,6) 5 6>>> Print (a)
Python return and lambda functions