Sometimes you need a tiny function — just one line — and giving it a name feels like overkill. Python lets you create anonymous functions (functions without a name) using the lambda keyword.
The syntax is: lambda parameters: expression
↗️
Loading editor...
↶
↷
Both do the exact same thing. But the lambda is just one line — no def, no return, no name needed.