while i<size(Array):
for index, k in enumerate(Array1):
if (k==Array[i]):
print index
i=i+1
, , , i < size(Array) while , , , .
, , , : .
Array1, , .
I think you want to iterate over both lists at the same time. Do not do this by creating two loops, you only need one loop.
for index, k in enumerate(Array):
if k == Array1[index]:
print index
A better approach, but perhaps more understandable for beginners:
for index, (value1, value2) in enumerate(zip(Array, Array1)):
if value1 == value2:
print index
Zip zips two lists together, making it very easy to iterate in parallel.
source
share