Fill: Lambda Keyword
Fill in the Blank Medium
Question
Fill in the blank to create a lambda that doubles a number.
Code
double = ___ x: x * 2
Hint
The keyword for anonymous functions is...
Explanation
lambda creates an anonymous function. lambda x: x * 2 is equivalent to def double(x): return x * 2. Lambdas are limited to a single expression and are often used with map, filter, and sorted.
Related Resources
Related Lessons
- Lambda Functions
Lambda syntax.
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.