Created
September 14, 2020 14:59
-
-
Save BetterProgramming/d76049f57317e9c79437f8ce3df44503 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def multiply(x,y): | |
return x*y | |
num1=[1,2,3,4] | |
num2=[2,4,6,8] | |
s=map(multiply,num1,num2) | |
#Returns a map object | |
print (s)#Output:<map object at 0x0158E4D8> | |
print (type(s))#Output:<class 'map'> | |
#converting map object to list() constructor. | |
print (list(s))#Output:[2, 8, 18, 32] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment