> For the complete documentation index, see [llms.txt](https://lei-d.gitbook.io/leetcode/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lei-d.gitbook.io/leetcode/python-tips/lambda.md).

# Lambda

A lambda statement is used to create new function objects. Essentially, the lambda takes a parameter followed by a single expression only which becomes the body of the function and the value of this expression is returned by the new function.

```python
points = [ { 'x' : 2, 'y' : 3 },
           { 'x' : 4, 'y' : 1 } ]

points.sort(key=lambda i : i['y'])
print points
# output: [{'y': 1, 'x': 4}, {'y': 3, 'x': 2}]
```
