Subjects

All subjects Django Java Python React Spring Boot JavaScript PHP
Sign Up Free
Question 3 of 10 · Functions and Lambda Expressions
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?