Importance of Lambda | Sololearn: Learn to code for FREE!

+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 ?

6/20/2020 4:44:56 PM

Ketan Lalcheta

2 Answers

New Answer

+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.

+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