Print 10 to 15 except 13

EasyIf-Else Programs · 28 of 64

Write a Python program to print all the numbers from 10 to 15 except 13.

Advertisement
Output
10
11
12
14
15

Approach

  1. Loop through the range and skip 13 with continue.

Solution

Python
for n in range(10, 16):    if n == 13:        continue    print(n)
Output
10
11
12
14
15

Line by line

Lines 2-3

continue skips the rest of the loop body for 13 only.

Learn the concept

New to this topic? Read the lesson, then come back.

More if-else programs

← All 64 If-Else Programs

Leave a Comment