Okay i understand how this works but why? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Okay i understand how this works but why?

Why not just define a function or just make it its own line? I mean you cant reuse the lambda can you? Wouldnt make sense ii you could.

7th Aug 2016, 11:04 PM
Demonstratorz TDB
Demonstratorz TDB - avatar
5 Answers
+ 3
Nvm i see it now that ive continued with the lesson
7th Aug 2016, 11:35 PM
Demonstratorz TDB
Demonstratorz TDB - avatar
+ 3
yes you can reuse for example : var = lambda x,x +3 the use it like this : var(2) it will print 5
9th Aug 2016, 2:27 AM
Mohammad Amin Delshad
Mohammad Amin Delshad - avatar
+ 2
lambda gives flexibility, as we can modify our code on the fly . IMO we shouldn't use it while building code as u mentioned we can't use it more than once.
17th Aug 2016, 10:19 AM
tanujit d
tanujit d - avatar
+ 2
in this case you are right but with a little creativity you can use it better. Ill write a code and you will see what I mean. just remind me to do it cause im busy now.
19th Nov 2016, 2:41 PM
Hetbo.net
Hetbo.net - avatar
+ 1
Thanks
9th Aug 2016, 3:21 AM
Demonstratorz TDB
Demonstratorz TDB - avatar