r = [1,2,3,4,5,6,7,8,9,10,11,12,13]
for i in range(len(r)):
print(i)
if r[i] %2 == 0:
print('found even')
i+=3
It still goes through all i's and not jumps over by 3. Why is that? Is the i somehow losing its scope?
r = [1,2,3,4,5,6,7,8,9,10,11,12,13]
for i in range(len(r)):
print(i)
if r[i] %2 == 0:
print('found even')
i+=3
It still goes through all i's and not jumps over by 3. Why is that? Is the i somehow losing its scope?
for
is not the correct loop, use while:
r = [1,2,3,4,5,6,7,8,9,10,11,12,13]
i = 0
while i < len(r):
print(i)
if r[i] % 2 == 0:
print('found even')
i += 3
else:
i += 1