Q9: What are Lambda functions and what limitations do they enforce?
Lambda functions are small, anonymous single-line functions created via lambda params: expression. They automatically return expression results and are restricted to a single expression (no statements, assignments, or multiline loops allowed).
Key Takeaways
- Single-expression inline functions.
- Useful for short callbacks in
map(),filter(), orsorted(key=...).
Knowledge Check
Can a lambda function contain explicit return statements or assignment operations in Python?