World's Best AI Learning Platform with profoundly Demanding Certification Programs
Designed by IITian's, only for AI Learners.
Explain lambda function in detail with example
Lambda function in Python can accept any number of arguments, but can only have a single expression. It is generally used in situations requiring an anonymous function for a short time period. Lambda functions can be used in either of the two ways:
division = lambda x, y : x / y print(division(12, 3)) # output => 4.0
def wrapperfun(n): return lambda x : x * n mulvalue = wrapperfun(8) print(mulvalue(3)) # output => 24