0
my version is 3.5.2 and several attempts to make a break statement has failed.
does break have to be in parenthisis, quotation? mine is still runining at the time of this printing. i = 5 while "TRUE": print(i) i = i + 1 if i <= 2: break
5 odpowiedzi
+ 2
because you init i with 5 which is greater than 2, so you never will fulfill your if condition.
also you have to intent all lines which should be within the loop.
from intent perspective only the print statement is within the loop
0
mine will not run unless indentation and syntax are correct.
i = 5
while True:
print(i)
i = i + 1
if i <= 2:
break
still running.
0
Same Problem try
i = 20
you never fulfill the condition i <= 2 because you start with 5!
0
that is the question i was given, it started as i = 5.
0
why don't you use a statement i mean you can use print('Stop') in the if condition and stop the probleme of this break.
and about your code it will runs because i>2 and i starts from 5 and will add 1 in each line i think you want to use i = i - 1 to get what you want
hope that helps