In this example, you will learn about lambda function in python.
a lambda function is just like any normal python function, except that it has no name when defining it, and it is contained in one line of code.
Syntax :
lambda argument(s): expression
Example :
x = int(input("Input first value :: "))
y = int(input("Input second value :: "))
multiply = lambda x,y : x*y
print('Multiplication is :: ', multiply(x,y))
Output :
Input first value :: 10
Input second value :: 5
Multiplication is :: 50
Explanation :
The program will create lambda function to multiply two arguments and we can use it as variable whenever required.
Ask anything about this examples