Web Analytics

Python map() Function

Built-in Function Functional

The map() function executes a specified function for each item in an iterable. The item is sent to the function as a parameter.

Syntax

map(function, iterables)

Parameters

Parameter Description
function Required. The function to execute for each item
iterables Required. A sequence, collection or an iterator object. You can send as many iterables as you like, just make sure the function has one parameter for each iterable

Return Value

A map object (which is an iterator).

Example

Using the map() function:

Output
Click Run to execute your code

Related Functions