Amazing technological breakthrough possible @S-Logix

Office Address

  • #5, First Floor, 4th Street Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 Landmark : Samiyar Madam
  • +91- 81240 01111

Social List

What is anonymous function or lambda function in python?


To see what is lambda function and syntax of lambda function in python3.


Anonymous or lambda function.

   Lambda functions are small functions usually not more than a line.

   Its also called as one line function.

   Lambda function can have any number of arguments but only one expression.

   It defined with keyword lambda.

   Its mostly used for mathematical expression

Sample Code

#lambda function to double the input
d = lambda x: x * 2
print(“——First output——\n”)

#lambda functions with mapping
print(“——Second output——\n”)
newlist=list(map(lambda x: x * 2,list1))

What is anonymous function or lambda function in python