The Lambda function is a one-liner alternative to the regular functions. It can be defined in a single line of code and thus takes less time and space in our code. For example, in the below code, we can see multiple examples of replacing a regular function with a lambda function.
Function with one argument
##Regular function
def multiply_by_2(x):
return x*2
##lambda function
lambda x: x*2
Function with 2 or more arguments
##Regular function
def multiple_three_numbers(x,y,z):
return x*y*z
##lambda function
lambda x, y, z: x*y*z
Note: The lambda function cannot replace loop in python but we help us to convert a muli-line functionality into one-liner.