Let the two lists be
x = [0,1,2,2,5,2,1,0,1,2]
y = [0,1,3,2,1,4,1,3,1,2]
How to find the similar elements in these two lists in python and print them. What I am doing-
for i, j in x, y:
if x[i] == y[j]:
print(x[i], y[j])
I want to find elements like x[0], y[0] and x[1], y[1] etc. This does not work, I am new to python. I want to find the exact index at which the elements are common. I want to find the index 0, 1, 3, 6, 8, 9; because the elements at these indices are equal