map()

say it: “MAP” /mæp/

Runs a function on every item in a collection.

What does map() do?

map() runs a function on every item in a collection and gives back the results.

prices = ["4.50", "3.25"]
numbers = list(map(float, prices))
print(numbers)  # [4.5, 3.25]

Level: Journeyman · More Python terms at this level

Updated

In other subjects