Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
The for loop
The while loop
Nested loops
break and continue
19. continue with for loops


Good! The continue works for the for loops as well! For instance:

for i in range(1, 11):
  if i % 2 != 0:

The program above prints even numbers from 1 to 10 (i.e., 2, 4, 6, 8, 10). When we use continue, the rest of the block is skipped, i is incremented, and another iteration begins.


Write a program that will find the remainder from dividing by 5 for numbers from 1 to 15. Each time, show a sentence in the following format:

The remainder of dividing {number} by 5 is {remainder}

Do not print anything for numbers that have a remainder of 0.

Stuck? Here's a hint!

Use a range from 1 to 16 to get numbers until 15. Check the value of i % 5 inside the loop.