# Write a code snippet that prompts the user for an integer named number and prints out “Good Number” if the input meets any one the following conditions, and prints out “Bad Number” if it does not :number equals 5number equals 7number is between 10 and 20 (non-inclusive)number is greater than 30.

Question
28 views
1. Write a code snippet that prompts the user for an integer named number and prints out “Good Number” if the input meets any one the following conditions, and prints out “Bad Number” if it does not :
• number equals 5
• number equals 7
• number is between 10 and 20 (non-inclusive)
• number is greater than 30.
check_circle

Step 1

Following is the python program that takes input from user and print Yes if the number meets any of the following conditions else print No.

• number equals 5
• number equals 7
• the number is between 10 and 20 (non-inclusive)
• the number is greater than 30

Approach:

• Prompt user to enter any number.
• Save it in variable named number. Use if condition to check if the number meets any of the given conditions.
• Or is used inside if statement because for the number to be Good it needs to meet any of the conditions.
• Finally print number as good or bad according to condition.

Step 2

Code:

#prompt user to input any number and save it in variable named number

number = int(input("Enter a number: "))

#using if condition to check if the number meets any of the condition given

if(number==5 or number==7 or (number>10 and number<20) or number>30):

#if the entered ...

### Want to see the full answer?

See Solution

#### Want to see this answer and more?

Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*

See Solution
*Response times may vary by subject and question.
Tagged in