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
from itertools import starmap | |
def multiply(x,y): | |
return x*y | |
num1=[(1,11),(2,22),(3,33),(4,44)] | |
result=starmap(multiply,num1) | |
#Returns a starmap object | |
print (result)#Output:<itertools.starmap object at 0x00CAE4D8> | |
#converting starmap object to list() constructor. | |
print (list(result))#Output:[11, 44, 99, 176] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment