Loops · Lesson 14 of 27
break and continue
Two keywords control a loop from the inside:
breakstops the loop completely.continueskips the rest of this round and goes to the next one.
for i in range(1, 10):
if i == 5:
break
print(i) # 1 2 3 4for i in range(1, 6):
if i == 3:
continue
print(i) # 1 2 4 5 (3 is skipped)Your task
Read a number n. Print every number from 1 to n, skipping numbers divisible by 3. Use continue.
For n = 10, print 1 2 4 5 7 8 10, one number per line.