map in puthon code example
Example 1: pyhton map
def calculateSquare(n):
return n*n
numbers = (1, 2, 3, 4)
result = map(calculateSquare, numbers)
print(result)
# converting map object to set
numbersSquare = list(result)
print(numbersSquare)
Example 2: map in python
map(function_to_apply, list_of_inputs)