0
Does lamda saves execution time or memory..? Why we use it instead of normal function.
2 Answers
+ 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))