Saturday 1 October 2022

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.)

For Example :

Python map() with tuple

# map() with tuple
map_iterator = map(to_upper_case, (1, 'a', 'abc'))
print_iterator(map_iterator)

Output:

1 A ABC 

Source : https://www.geeksforgeeks.org/python-map-function/

https://www.digitalocean.com/community/tutorials/python-map-function

No comments:

Post a Comment