Created
January 18, 2021 16:03
-
-
Save BetterProgramming/0ce39af038f67a9a1b5ec4785d873b1a 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
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