Skip to content

Instantly share code, notes, and snippets.

@BetterProgramming
Created September 14, 2020 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BetterProgramming/d76049f57317e9c79437f8ce3df44503 to your computer and use it in GitHub Desktop.
Save BetterProgramming/d76049f57317e9c79437f8ce3df44503 to your computer and use it in GitHub Desktop.
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