How to Use Python's map() Function

In Python, there are three useful global functions - map(), filter(), and reduce() - that we can use to work with collections. map() is specifically used to apply a function to each item in an iterable, such as a list, and create a new list with the same number of items, but with modified values. Let’s take a look at an example that demonstrates the use of map(). Suppose we have a list of numbers [1, 2, 3], and we want to double each number in the list....