# 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.

**It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.**

https://www.w3resource.com/python-exercises/python-conditional-exercise-8.php

**Weekly Trends and Language Statistics**- Weekly Trends and Language Statistics