`lambda` creates a small, anonymous function limited to a single expression — no statements, no multiple lines.
python
double = lambda x: x * 2
pairs = [("eth", 3), ("btc", 1)]
pairs.sort(key=lambda p: p[1])Lambdas are most useful as short throwaway callbacks passed to `sorted`, `map`, or `filter`; for anything nontrivial, a named `def` function is clearer and easier to test.