Define lambda function inside another function : lambda function « Function « Python






Define lambda function inside another function

Define lambda function inside another function


foo = [2, 18, 9, 22, 17, 24, 8, 12, 27]
 
print filter(lambda x: x % 3 == 0, foo)

print map(lambda x: x * 2 + 10, foo)

print reduce(lambda x, y: x + y, foo)



           
       








Related examples in the same category

1.lambda function definition with default valuelambda function definition with default value
2.Define function in Lambda FormsDefine function in Lambda Forms
3.Difference between a normal function and a lambda functionDifference between a normal function and a lambda function
4.Use lambda to define simple functionUse lambda to define simple function