Skip to content

Instantly share code, notes, and snippets.

@Kush1101
Created October 27, 2020 11:37
Show Gist options
  • Save Kush1101/33a0a2fe4a13fa3c367eaceb5df09cc9 to your computer and use it in GitHub Desktop.
Save Kush1101/33a0a2fe4a13fa3c367eaceb5df09cc9 to your computer and use it in GitHub Desktop.
from itertools import starmap
from operator import add, mul
iterable = [(1,3), (2,4), (3,0), (5,6)]
for i in starmap(add, iterable):
print(i, end = ' ')
# 4 6 3 11
for i in starmap(mul, iterable):
print(i, end = ' ')
# 3 8 0 30
for i in starmap(min, iterable):
print(i, end = ' ')
# 1 2 0 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment