✨ Iterators, Generators & Decorators
Lambdas & Higher-Order Functions
map, filter, sorted with key=…
lambda creates a small anonymous function. Pair it with map, filter, or sorted to transform sequences elegantly.
nums = [1, 2, 3, 4]
print(list(map(lambda x: x * 2, nums))) # [2, 4, 6, 8]
print(list(filter(lambda x: x % 2, nums))) # [1, 3]