World's Best AI Learning Platform with profoundly Demanding Certification Programs
Designed by IITians, only for AI Learners.
Designed by IITians, only for AI Learners.
New to InsideAIML? Create an account
Employer? Create an account
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