Why use lambda when you can use list comprehension? | Sololearn: Learn to code for FREE!

+2

Why use lambda when you can use list comprehension?

6/2/2018 2:55:31 AM

Chris Sheffield

5 Answers

New Answer

+5

Lambda allows you to pass a function as an argument for another function these are known as anonymous functions rather than writing a too long code https://code.sololearn.com/c9lwxKCrkqBc/?ref=app

+5

See the effect on time when adding lambdas to map and filter as oposed to listcomp https://code.sololearn.com/caVGRw4he3EQ/?ref=app

+1

Ahhh i see

+1

Very well explained thank you

+1

But lambda kind of make thr code difficult to read