# Python Exercise: Prints all the numbers from 0 to 6 except 3 and 6

## Python Conditional: Exercise-8 with Solution

Write a Python program that prints all the numbers from 0 to 6 except 3 and 6.

Note : Use 'continue' statement.

**Pictorial Presentation:**

**Sample Solution:**

**Python Code:**

```
# Iterate through numbers from 0 to 5 using the range function
for x in range(6):
# Check if the current value of 'x' is equal to 3 or 6
if (x == 3 or x == 6):
# If 'x' is 3 or 6, skip to the next iteration without executing the code below
continue
# Print the value of 'x' with a space and without a newline (end=' ')
print(x, end=' ')
# Print a new line after printing all numbers satisfying the condition
print("\n")
```

Sample Output:

0 1 2 4 5

**Flowchart: **

**Python Code Editor: **

**Have another way to solve this solution? Contribute your code (and comments) through Disqus.**

**Previous:** Write a Python program that prints each item and its corresponding type from the following list.

**Next:** Write a Python program to get the Fibonacci series between 0 to 50.

**What is the difficulty level of this exercise?**

Test your Programming skills with w3resource's quiz.

**Weekly Trends**- Python Interview Questions and Answers: Comprehensive Guide
- Scala Exercises, Practice, Solution
- Kotlin Exercises practice with solution
- MongoDB Exercises, Practice, Solution
- SQL Exercises, Practice, Solution - JOINS
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- JavaScript String Exercises
- JavaScript HTML Form Validation
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join