30-Days-Of-Python
30-Days-Of-Python copied to clipboard
corrected while loop code
In the python while loop example the code will only output 1,2,3 because the code after the continue statement will never be reached when count ===3
count = 0
while count < 5:
count = count + 1
if count == 3:
continue
print(count)
Here is my proposed code, i've tested it and it works.
count = 0
while count < 5:
count = count + 1
if count == 3:
continue
print(count)
# The above while loop only prints 0, 1, 2, 4 and 5 (skips 3).