# Python Lambda Functions

> Learn how lambda functions work in Python: tiny anonymous functions with the lambda keyword and a single expression, often used with map() and filter().

Author: [Flavio Copes](https://flaviocopes.com/about/) | Published: 2021-01-07 | Topics: [Python](https://flaviocopes.com/tags/python/) | Canonical: https://flaviocopes.com/python-lambda-functions/

Lambda functions (also called anonymous functions) are tiny functions that have no name and only have one expression as their body.

In [Python](https://flaviocopes.com/python-introduction/) they are defined using the `lambda` keyword:

```python
lambda <arguments> : <expression>
```

The body must be a single expression. Expression, not a statement.

> This difference is important. An expression returns a value, a statement does not.

The simplest example of a lambda function is a function that doubles that value of a number:

```python
lambda num : num * 2
```

Lambda functions can accept more arguments:

```python
lambda a, b : a * b
```

Lambda functions cannot be invoked directly, but you can assign them to variables:

```python
multiply = lambda a, b : a * b

print(multiply(2, 2)) # 4
```

The utility of lambda functions comes when combined with other Python functionality, for example in combination with `map()`, `filter()` and `reduce()`.
