There seems to be some serious problem with continue in Python: for eg:
for i in range(1,10):if i % 2 == 0:continueprint i
works as intended, but
i = 0while(i < 10):if i %2 == 0: continuei += 1print i
the while loop never terminates!
There seems to be some serious problem with continue in Python: for eg:
for i in range(1,10):if i % 2 == 0:continueprint i
works as intended, but
i = 0while(i < 10):if i %2 == 0: continuei += 1print i
the while loop never terminates!
Your i
is never incremented in the second snippet. Remove the continue.
i = 0
while(i < 10):if i %2 == 0: # i == 0; continue without increment the value of i <-- stuck here!continuei += 1print i