Created
October 27, 2020 12:01
-
-
Save Kush1101/2d01495a3e86910ece344a71aa8bbb80 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 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