Create a function that adds 10 to any number you send:
x = lambda a : a + 10
print(x(5))
Try it Yourself » Definition and UsageThe lambda
keyword is used to create small anonymous functions.
A lambda
function can take any number of arguments, but can only have one expression.
The expression is evaluated and the result is returned.
More Examples ExampleA lambda function with three arguments:
x = lambda a, b, c : a + b + c
print(x(5, 6, 2))
Try it Yourself » Related PagesRead more about lambda functions in our Python Lambda Tutorial.
Track your progress - it's free!
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4