How do I compare the variables when using zip in a for loop?
b are elements from the resulting combined list. If we have two lists,
zip() combines them to the shortest length of the two, like this:
list_a = [3, 9, 17, 15, 19] list_b = [2, 4, 8, 10, 30, 40, 50, 60, 70, 80, 90] # RESULT: (3,2), (9,4), (17,8), (15,10), (19,30)
The resulting pairs of elements are stored in
b respectively. So the first time our loop runs,
a will be
b will be
2. Comparing these two variables is done as a comparison between two numbers, since they are not lists.
if a > b:, for example.