continue and break

Predict the output · Medium · §7.5 Changing the flow

Predict the two lines of output without running the code.

Code

for i in range(1, 6):
    if i == 3:
        continue
    print(i, end=" ")
print()
for i in range(1, 6):
    if i == 3:
        break
    print(i, end=" ")

Solve this problem in your browser

Python runs in your browser and checks your answer right away. Hints and the answer are on the problem page.