Question: Assignment Descript Write a Python program that takes a positive number input from the user: If the number is a prime number, print Number X

Assignment Descript
Write a Python program that takes a positive number input from the user:
If the number is a prime number, print "Number X is PRIME" (where x is the user input).
If the number is NOT a prime number, print "Number X is NOT PRIME" (where X is the user input)
If the number is negative, your code should print "Number x is not allowed" (where x is the user
Your .py file should start like this:
# Your Name
# Your University ID
myNum = eval (input('Enter a number: '))
Requirements:
Use myNum as the testing variable.
Check if myNum is a positive number. If not, display an error message.
Use appropriate string concatenation and formatting to display the results neatly (no extra space
Example Outputs:
Enter a number: 5
Number 5 is NOT PRIME
Enter a number: 4
Number 4 is PRIME
Enter a number: -1
Number -1 is not allowed
Hints:
A prime number can only be divided by itself and 1. Use the modulus operator (%) to check if the number.
 Assignment Descript Write a Python program that takes a positive number

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!