0

how does this program work??? doesn't the break command break the loop prematurely, if that's the case there should be only 0 displayed as output followed by the print statement.

loops and break statement

9th Nov 2016, 2:58 AM
Clinton Moses
Clinton Moses - avatar
2 Antworten
+ 1
In the example >= means "greater than or equal to", in this case: 5. The if statement will run 5 times, failing each time until i==6, when the condition is True and break executes. Technically the increment is 1 so the test could be ==. Specifying >= covers the larger case in a safer way.
9th Nov 2016, 3:39 PM
Kirk Schafer
Kirk Schafer - avatar
0
python does not have a complire
9th Nov 2016, 5:43 AM
paul mwengei
paul mwengei - avatar