defMaxmin (A, b):if(a>b):returnA, bElse: returnb,a max,min=maxmin (8,95)Print "The maximum value is:", MaxPrint "The minimum value is:", MinPrint "*********lambda***********"g=LambdaX:x*8Print "Lambda creates an anonymous function:", G (5) G1=LambdaX, Y, Z: (x+y) *ZPrintG1 (5,2,10)Print "********** Logarithmic ************" fromMathImportLogPrintLog (64,2)#The first argument is the true number, the second argument is the basePrint "******* use lambda to write a fixed base logarithm ***********"defMake_function (Base):return LambdaX:log (x,base) Mk=make_function (8)Print "The logarithm is 8, and the value of true number 64 is:", MK (64)
Results:
Return multiple values
The maximum value is: 95
The minimum value is: 8
lambda***********
Lambda Create anonymous function: 40
70
Logarithmic ************
6.0
Write a fixed base logarithm with lambda
The logarithm is 8, and the value of true number 64 is: 2.0
Python returns the use of multiple values +lambda