Python lambda Keyword
Example
Create a function that adds 10 to any number you send:
x = lambda a : a + 10
print(x(5))
Try it Yourself »
Definition and Usage
The 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
Example
A lambda function with three arguments:
x = lambda a, b, c : a + b + c
print(x(5, 6, 2))
Try it Yourself »
Related Pages
Read more about lambda functions in our Python Lambda Tutorial.
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.