0

Does lamda saves execution time or memory..? Why we use it instead of normal function.

20th Mar 2020, 7:40 PM
Kafeelur Rahman T K
Kafeelur Rahman T K - avatar
2 Antworten
+ 5
Most of the times we use lambda when we need a function somewhere, but we need it only once, so there's no point defining a regular function. Let's say you want to print a bunch of numbers after you've made some calculation on each one (totally random example): n = [1, 3, 7, 5, 11] print(*map(lambda x: (x+2)*3, n))
20th Mar 2020, 7:57 PM
HonFu
HonFu - avatar