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))





Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Tuesday, March 12, 2019

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250