Which limitation applies to a lambda expression in Python?
Correct answer D. Its body must be a single expression
Explanation
A lambda creates a small anonymous function whose body is restricted to one expression, whose value is returned automatically. It cannot contain statements such as assignments with =, return or loops. It can take any number of arguments, accept defaults and be assigned to a name, although PEP 8 prefers def for named functions.
Answer checked How we write and check questions
Discussion