zip with different length iterables PREMIUM

Series: Looping
Trey Hunner smiling in a t-shirt against a yellow wall
Trey Hunner
4 min. read 3 min. video Python 3.8—3.12

What happens if you use Python's built-in zip function with iterables that have different lengths?

Zipping iterables matches up each iterable item that's at the same position

Python's zip function is helpful for looping over multiple iterables at the same time:


A Python Tip Every Week

Need to fill-in gaps in your Python skills? I send weekly emails designed to do just that.