Certified Associate in Python Programming (PCAP-31-03) — Question 65
Which of the following lambda definitions are correct? (Choose two.)
Answer options
- A. lambda(x,y) = x//y - x%y
- B. lambda x,y: return x//y - x%y
- C. lambda x,y: (x,y)
- D. lambda x,y: x//y - x%y
Correct answer: C, D
Explanation
Options C and D are correct lambda function definitions in Python. Option C correctly returns a tuple of the inputs, while option D performs a valid calculation. Options A and B are incorrect due to syntax errors; A uses an invalid assignment operator and B incorrectly uses 'return' within a lambda expression.