The function map takes a function and an iterable as arguments and returns a new iterable with the function applied to each argument.
Example:
def add_five(x):
return x+5
nums = [11, 22, 33, 44, 55]
result = list(map(add_five, nums))
print (result)
In the above example map takes two arguments:
1. add_five function
2. nums list (We know that list is an iterable object)
map applies add_five function to each and every element of the list nums, and the resulted list is stored in the variable result. We are doing type casting using "list" here. This typecasting is required for Python3.x, in Python2.x this type casting is not required as it is done implicitly.