Python Lambda Functions

What Is A Lambda Function?

satyabrata pal
ML and Automation
1 min readNov 14, 2019

--

  • Lambda functions can help you to write anonymous functions for which you don’t need to define a body.
  • Lambda functions can have multiple arguments but only one expression.
  • Lambda functions are short and simple.

Lambda functions can be assigned to a variable

A variable can contain a lambda function.

Lambda functions in map() method

Lambda functions can be used inside map() method.

Lambda functions in filter() method

Lambda functions can be used inside filter() method to use an expression to filter items from a list.

Lambda functions in reduce() method

Lambda functions prove to be useful in reduce() method as well.

End Notes

I have listed a few examples where lambda functions can be used, but there are many more use cases where lambda functions are useful. Do post in the comments section if you happen to come across any such use cases which I didn’t list here.

Announcement

I am so excited to announce that my first deep learning course is now available on Udemy . The course is available at 95% discount till 31st May midnight. Use this link to apply the discount code.

--

--

satyabrata pal
ML and Automation

A QA engineer by profession, ML enthusiast by interest, Photography enthusiast by passion and Fitness freak by nature