Map function returns the map object after applying the function on all the elements of the set of values stored in the list, tuple, etc.
Syntax:
Map (function, list or tuple)
Example:
# Return square of n
def addition(n):
return n*n
# We double all numbers using map()
numbers = (1, 2, 3, 4)
result = map(addition, numbers)
print(list(result))
Output:
[1, 4, 9, 16]
You can check out this Python Functions to learn more about map function with examples.
Also, watch this video on Python Functions: