AgQuiz #36: Python lambda

This is a regular “data quiz”. Follow it on LinkedIn. Test your knowledge or learn something new.

Today Question:

In Python, lambda defines:

A) A variable 

B) An anonymous function 

C) A class 

D) An import 


Correct Answer: B

Explanation

A lambda in Python defines an anonymous single-expression function used for simple operations without creating a standard def function. It is often used with map(), filter(), and reduce() to quickly transform or filter collections. For more complex logic, def functions are preferred for readability.