Interview Question

What are lambda functions?

lambda creates a function from one expression.

💡 Concept ✅ Quick Revision 🐍 Python

Answer

A lambda expression creates a small anonymous function from one expression. • Its body is a single expression, not a statement block. • The expression result becomes the return value. • Use def when a function needs statements, annotations, documentation, or a meaningful name.

💡 Simple Example

square = lambda value: value * value print(square(4))

Output

16

⚡ Quick Revision

lambda creates a function from one expression.