Map
www.tritechtrainings.com Map Function Python map() function is used to apply a function on all elements of a specified iterable and return map object. Python map object is used as an iterator, so we can iterate over its elements. We can also convert map object to sequence objects such as list, tuple, etc. using their factory function. Syntax: map(function,iterable,....) We can pass multiply iterable arguments to map() function, in that case, the specified function must have that many arguments. This function will be applied to these iterable elements in parallel. With multiple iterable arguments, the map iterable stops when the shortest iterable is exhausted. Ex: def addition(n): return n + n numbers = ( 1 , 2 , 3 , 4 ) result = map (addition, numbers) print ( list (result)) Output: [2,4,6,8]