Consider the flexibility of this code;
number = 1
for func in [lambda x: x - 1, lambda x: x * 2, lambda x: x + 2]:
number = func(number)
print(number)
No need to declare functions with a name here!
lambda: nameless
Consider the flexibility of this code;
number = 1
for func in [lambda x: x - 1, lambda x: x * 2, lambda x: x + 2]:
number = func(number)
print(number)
No need to declare functions with a name here!