Functional-Style Python
Prerequisites: Functions
Python supports functional-style tools alongside its object-oriented
core: functions as values, lambda for small anonymous functions, and
map/filter for transforming sequences.
numbers = [1, 2, 3, 4, 5]
doubled = list(map(lambda n: n * 2, numbers))
evens = list(filter(lambda n: n % 2 == 0, numbers))
In practice, most Python style guides prefer list comprehensions
([n * 2 for n in numbers]) over map/lambda for readability — worth
knowing map/filter exist since they appear in other people's code, but
comprehensions are the more idiomatic default in this language.