Articles → Python → Lambda Function In Python
Lambda Function In Python
Purpose
Syntax
lambda <input variables>: <output variable>
Example
a = lambda : 3.14 # No input parameter and returns a hard coded value
b = lambda num: num *2 # one input parameter
c = lambda num1, num2: num1 *num2 # More than one input parameter
print("a = ",a(),",b=",b(2),",c=",c(3,4))
Output