Lambda Syntax
Multiple Choice Easy
Question
What is a lambda in Python?
Hint
Lambdas are single-expression functions.
Explanation
A lambda is an anonymous function defined in a single expression: lambda x: x * 2. It is equivalent to def f(x): return x * 2 but without a name. Lambdas are often used with map(), filter(), and sorted(): sorted(items, key=lambda x: x["age"]). They are limited to one expression — no statements or multi-line code.
Related Resources
Related Lessons
- Lambda Functions
Learn lambda functions.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.