Skip to content

Instantly share code, notes, and snippets.

@BetterProgramming
Created January 18, 2021 16:03
Embed
What would you like to do?
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