Amazing technological breakthrough possible @S-Logix

Office Address

  • 2nd Floor, #7a, High School Road, Secretariat Colony Ambattur, Chennai-600053 (Landmark: SRM School) Tamil Nadu, India
  • +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