Function Details: map

Description


Applies function to every item of iterable and return an iterator of the results.


Extended Description


The map() function applies a given function to each item of an iterable (or multiple iterables) and returns an iterator of the results. If additional iterables are passed, the function must take that many arguments and is applied to the items from all iterables in parallel. With multiple iterables, the iterator stops when the shortest iterable is exhausted.


Read More about map from Python Documentation

Function Signature


map(function: Callable, iterable: Iterable, *iterables: Iterable) -> map

Module: builtins

Class: map

Parameters



Parameter List


  • function: Callable
  • iterable: Iterable
  • *iterables: Iterable

Return


Returns a map object (an iterator) of the results.


Return Type


map

Output

Explanation

This example shows how to use map() with a lambda function to square each number in a list.