map()

Applies a function to every item in an iterable and returns a map object.

Syntax

python
map(function, iterable)

Example

python
nums = [1, 2, 3, 4, 5]
doubled = list(map(lambda x: x * 2, nums))
# [2, 4, 6, 8, 10]