How to increment a counter while looping
for param in range (len (mass)):
if a == b:
...
...
param + = 5
else:
...
This could have been done manually in C #
for (i = 0; i & lt; val; i ++)
{
if (a == b)
{
...
i + = 5;
}
else ...
}
But it doesn’t work in python, the counter keeps going no matter what.
Answer 1, authority 100%
Replace the for
loop with while
:
param = 0
while param & lt; len (mass):
if a == b:
...
...
param + = 5
else:
...
param + = 1