map()
function is used to find the applies a given function to each item of an iterable (list, tuple etc.) and returns a list of the results in Python for the given input.
map()
function is a part of Python Built-in Functions.
Syntax of map()
Function
The syntax of
map()
function in Python is:
map(function, iterable, ...)
Parameters of map()
Function in Python
x
– Where x
is any valid . This parameter is required.
Compatibility
map()
function is available and compatible with both Python 2.x
and 3.x
.
Return Value of map()
Function in Python
map()
function returns applies a given function to each item of an iterable (list, tuple etc.) and returns a list of the results for the given input.
Python map()
Function Example 1
Example CODE
Output:
Python map()
Function Example 2
Example CODE
Output: