Python Lambda functions are functions that do not have any name. They are also known as anonymous or nameless functions. The word ‘lambda’ is not a name, but its a keyword. This keyword specifies that the function that follows is anonymous.
A Lambda function is created using the lambda operator and its syntax is as follows:
lambda arguments: expression
Python lambda function can have any number of arguments but it takes just one expression. The inputs or arguments can start at 0 and go up to any limit. Just like any other functions, it’s perfectly fine to have lambda functions with no inputs. Therefore, you can have lambda functions in any of the following formats:
lambda : “Specify the purpose”
Here, the lambda function is not taking any arguments.
lambda a1: “Specify the use of a1“
Here, lambda is taking one input which is a1.
Similarly, you can have lambda a1, a2, a3..an.
Let’s take a few examples to demonstrate this:
a = lambda x: x*x
Have a look at this blog for detailed explanation: https://www.edureka.co/blog/python-lambda/