zip() in a for loop

We can use the zip() function in Python to make two lists show up side-by-side in a for loop, similar to a zipper on a coat / jacket – where two zipper sides come together.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
colors = ["Blue", "Yellow"]
objects = ["Sky", "Banana"]

# Make both lists show side-by-side
# using the variables: col and obj
for col, obj in zip(colors, objects):
    print(col, obj)

>Outputs: 
     Blue Sky
     Yellow Banana