How lambda works?

How does lambda works

6/25/2019 10:43:55 AM


2 Answers

New Answer


Lambda takes any variable and creates a function with it. i.e. lambda x:x+1 This increases any x number by 1 and then returns to the callback scope. It's very used on functional programming, like when you use map, filter... But it isn't very pythonic, so it's not recommended. Learn it, but i recommend avoiding the use.


Lambdas are anonymous functions. They work by applying a function on given input. For example: ——————————— square = lambda x: x*x square(5) >>>25 square(6) >>>36 ———————————- You can read more about it in this question: https://www.sololearn.com/Discuss/1550638/?ref=app Hope this helps 😊