Python Nested Lambda Function

Nested Lambda Function:

In Python, anonymous function means that a function is without a name. As we already know the def keyword is used to define the normal functions and the lambda keyword is used to create anonymous functions. When we use lambda function inside another lambda function then it is called Nested Lambda Function.

f = lambda a = 2, b = 3:lambda c: a+b+c
o = f()
print(o(4))

output:

9

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top