[Solved] Comparing values of a list in python with a for loop


I think this is what you mean.

a = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5]
b = [1, 2, 3, 4, 5]

for x in a:
    for y in b:
        if a[x] == b[y]:
            #Do stuff here
            print "found a match " + str(a[x])
        elif y == len(b) - 1:
            break

0

solved Comparing values of a list in python with a for loop