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


Picture showing the output of the lambda function in python



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

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250