0
Can someone explain each line.
i = 0 while 1==1: print(i) i = i + 1 if i >= 5: print("Breaking") break print("Finished")
3 odpowiedzi
+ 1
1) I=0 initialize a variable with starting value zero.
2) And while 1==1 stands for execute the loop while the value is true.
3)For true value print the value of i variable.
4)i=i+1 is used for incrementing the value of i so that loop can run for different value.
5) And if i>=5 the break the statement by 'break' statement.
0
the while loop will continue until i will be 5 because when i will be 5 the break statement under if clause will be executed and it will come out from loop.. so the result will be
012345 Breaking Finished
0
12345 Breaking Finished