The map()
It executes a specified function for each item in a given iterable (list,tuple etc) and returns a map of an object….
Table of contents
No headings in the article.
Map Function in Python.
map() function returns a map object(which is an iterator) of the results after applying the given function to each item of a given iterable (list, tuple etc.)
Syntax Syntax: map(fun, iter)
Parameters:
fun: It is a function to which map passes each element of given iterable.
iter: It is iterable which is to be mapped.
NOTE: You can pass one or more iterable to the map() function.
Returns: Returns a list of the results after applying the given function to each item of a given iterable (list, tuple etc.)
NOTE : The returned value from map() (map object) then can be passed to functions like list() (to create a list), set() (to create a set) .
Share if you found this insightful and follow me for more