Importance of Lambda | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Importance of Lambda

Hi Below is sample code: https://code.sololearn.com/c3LnP2CQUGZK/?ref=app Time calculator is not perfect option but still I could observe that lambda takes more time compared to normal comparator. What's the use of Lambda then ?

20th Jun 2020, 4:44 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
2 Answers
+ 3
You might want to consider the fact that you are using a server machine when you are executing the code off this app, what you might want to do is to run this code on your own machine(maybe a couple hundred times with at least 1000 times more values) and then check the results.
20th Jun 2020, 6:26 PM
Anubhav Mattoo
Anubhav Mattoo - avatar
+ 1
firstly, it's not consistent, sometimes lambda do faster. from what i know lambda functions at least in python is used because they only used once and contains only one line so you don't need to make another function for them but write implementation right here, because writing another function that has only one line for one case would be unnecessary
20th Jun 2020, 6:16 PM
Kirill Eremin