Python lambda keyword

Example

Create a function that adds 10 to any number sent:

x = lambda a : a + 10
print(x(5))

Run Instance

Definition and Usage

The lambda keyword is used to create small anonymous functions.

Lambda functions can accept any number of parameters, but can only have one expression.

This expression will be calculated and the result will be returned.

More Examples

Example

Lambda function with three parameters:

x = lambda a, b, c : a + b + c
print(x(5, 6, 2))

Run Instance

related pages

Please visit our Python Lambda Tutorial Learn more about lambda functions in Python.