Interview question
What is a lambda function? Lambda function क्या है?
Answer
square = lambda x: x ** 2
print(square(5)) # 25
# With map, filter, sorted
nums = [1, 2, 3, 4, 5]
squared = list(map(lambda x: x**2, nums))
evens = list(filter(lambda x: x % 2 == 0, nums))lambda x: x**2 # Simple anonymous function
# map, filter, sorted के साथ use करते हैंWas this answer clear?