Python map() function

The map() function in Python returns an iterator that applies a function to every item of iterable, yielding the results.

Syntax

Parameter

function: It is a required parameter that represents the function to execute for each item.

iterable: This parameter represents a sequence, collection, or an iterator object.

Return

This function returns an iterator that applies a function to every item of iterable, yielding the results. 

Example 1

Output

 

Pin It on Pinterest

Share This