+1 vote
in Python by
What is a map() function in Python?

1 Answer

0 votes
by

The map() function in Python is used for applying a function on all elements of a specified iterable. It consists of two parameters, function and iterable. The function is taken as an argument and then applied to all the elements of an iterable(passed as the second argument). An object list is returned as a result.

def add(n):

return n + n number= (15, 25, 35, 45)

res= map(add, num)

print(list(res))

o/p: 30,50,70,90

Related questions

+1 vote
asked Feb 15, 2021 in Python by SakshiSharma
+1 vote
asked Feb 15, 2021 in Python by SakshiSharma
...