+ 1
i = 0 / while i<5: / i += 1 / if i==3: / print("Skipping 3") continue / print(i). code starts at "1" and prints 5 why?
While loop
2 ответов
0
Because that's what you code tells it to do. Because i=0 and print(i) are outside the loop
0
You can post a code with the plus sign like this:
https://code.sololearn.com/cSZ4MkdJ553X/?ref=app
It starts with 1 because you first add 1 to i and then you print i.
You print 5 because you say i<5.
So with i==4 you entered the loop the last time and it's like before with 1. You first add 1 to I and then you print i.