+ 1
Why for loop and while loop display different answers even though the same continue statement used?
for i in range(10): square = i*i if square == 25: continue print(i) x = 0 while x < 10: square = x*x if square == 25: continue print(x) x+=1
5 Respuestas
+ 9
Hmm are you sure it's 'x' instead of 'i' in your 2nd approach?
0
Sr my mistake. The result is still not the same thou
0
I'm not sure if it's an endless loop because without the line x+=1 of yours, the result of while loop stops at 4. Anyway, thanks for your explanation.