A little bit of revision: to go through a list (array) using indexes, you need:
- a starting index (*)
- a loop
- increase the index within the loop (*)
(*) optional, based on the type of loop (see below)
In python, that would be something like:
index = 0
while index < limit:
# 'while' just checks if a condition is true or false
# so you have to take care of increasing the index
something = list[index]
# your code here
index = index + 1 # if you forget this, it will be an infinite loop!
or:
for index in range(limit):
# 'for' automatically increases the given variable
# staring from zero: index = 0, 1, 2 ... limit
something = list[index]
# your code here
Mixing the different loops may not a good idea.
Please this post if you found it useful. Thanks!