multiply = lambda a, b: a * b​
In this program, we have defined a lambda function named `multiply
` that takes two arguments `a
` and `b
` and returns their multiplication. The `lambda
` keyword is used to create the function, followed by the arguments `a
` and `b
`, separated by a comma.
The colon `:
` is used to separate the arguments from the expression to be evaluated, which is `a * b
` in this case.
We can then call this lambda function like any other regular function by passing the arguments :
multiply = lambda a, b: a * b
result = multiply(2, 5)
print(result)
10
2
` and `5
` to the `multiply
` lambda function and storing the result in a variable named `result
`. 10
`, which is the multiplication of `2
` and `5
`.