Documentation

Function defined in library builtins

map(functionsequence)

mapfunctionsequence

Given a function and a sequence, constructs a sequence of the results of applying the function to the elements of the sequence.

(Technical note: this function is actually a constructor of map objects.)

functionfunction to apply to the elements

sequencesequence to map

Sequence of elements transformed by applying the function
Code
list(map(abs, [-1, 2, -3]))
Result
[1, 2, 3]
Code
list(map(lambda n: n * 2, [1, 2, 3]))
Result
[2, 4, 6]

See also map in the official documentation

Logo of PyTamaro

PyTamaro is a project created by the Lugano Computing Education Research Lab at the Software Institute of USI

Privacy PolicyPlatform Version a9143b0 (Sun, 14 Dec 2025 12:09:46 GMT)