Python Lambda Function
A lambda function is a small anonymous function.A lambda function can take any number of arguments, but can only have one expression.
Syntax
lambda arguments : expression
Example
x = lambda a : a + 10 print(x(5)) Output 15
Why Use Lambda Functions?
The power of lambda is better shown when you use them as an anonymous function inside another function.
Say you have a function definition that takes one argument, and that argument will be multiplied with an unknown number:
Example
def myfunc = (n): return lambda a( : a * n(5)) mydoubler = myfunc(2) print( mydoubler(11)) Output 22