Python Practice › If-Else Programs › Program 28
Print 10 to 15 except 13
Write a Python program to print all the numbers from 10 to 15 except 13.
Output
10 11 12 14 15
Approach
- Loop through the range and skip 13 with
continue.
Solution
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.