Where we use lambda function in python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Where we use lambda function in python

9th Sep 2018, 1:11 PM
Vikash Kale
Vikash Kale - avatar
2 Answers
+ 2
Lambdas are useful when you need a quick function to do some work for you. It is an anonymous function when we don't need to actually give the function a name. >>> my_list = range(16) >>> print filter(lambda x: x % 3 == 0, my_list) In another hand, f you plan on creating a function you'll use over and over, you're better off using "def" and giving that function a name.
9th Sep 2018, 2:27 PM
Polina
Polina - avatar
0
i think anonymous is function which is nameless. I am right or wrong
10th Sep 2018, 3:51 AM
Vikash Kale
Vikash Kale - avatar