What can a lambda contain?
QuizEasy-MediumPython onlyAsked in: Infosys, TCS
A lambda is a small function with no name, written in one line. An expression is a piece of code that has a value (such as a + b); a statement is an instruction (such as return). Which statements about lambdas are true? Pick all that apply.
- A lambda body is a single expression whose value is returned
lambda x: return xis validsorted(users, key=lambda u: u.age)is a typical use- A lambda can hold several statements on separate lines
This question is part of Pro+
Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.