how do I compare subsequently integers in two lists?

I have two lists nums1 = [1,5,10,44,4] and nums2 = [5,3,10,55,3]; if I wanted to compare the first numbers of both lists with each other, then the second numbers, then the third numbers, and so on… i.e. 1 with 5, 5 with 3, 10 with 10, etc.

How can I do this?

My initial thought is to use two for loops, but then I end up comparing all of the list with each integer, when all I am after is to compare the one integer from one list with another integer from the other list.

Answer

Assuming both lists are equal length you can use a while loop

i = 0
while i < len(nums1):
    if num1[i] == nums2[i]:
        # do something when equal
    i = i + 1