Skip to content

Instantly share code, notes, and snippets.

@Kush1101
Created October 27, 2020 12:01
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 Kush1101/2d01495a3e86910ece344a71aa8bbb80 to your computer and use it in GitHub Desktop.
Save Kush1101/2d01495a3e86910ece344a71aa8bbb80 to your computer and use it in GitHub Desktop.
from itertools import zip_longest
iter1 = [1, 2, 3, 4, 5, 6]
iter2 = [1, 4, 9, 16, 25]
iter3 = [1, 8, 27, 64, 125]
for i in zip_longest(iter1, iter2, iter3, fillvalue = 0):
print(i)
# OUTPUT
"""
(1, 1, 1)
(2, 4, 8)
(3, 9, 27)
(4, 16, 64)
(5, 25, 125)
(6, 0, 0)
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment