+ 2
Why does lambda is anonymous function???
3 Réponses
+ 5
It is called anonymous because you can call the function without storing it in the namespace. Example:
power = (lambda x,y: x**y)(3,4)
print(power) # Output: 81
But of course we could have stored the function in the namespace by giving it a name and then called it more than once. Example:
pow = lambda x,y: x**y
print(pow(2,5)) # Output: 32
print(pow(5,3)) # Output: 125
print(pow(7,2)) # Output: 49
+ 3
Thnx
+ 1
For more refer to this lesson by sololearn :
https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2460/
Thanks