Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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 is not allowed" where is the user
Your py file should start like this:
# Your Name
# Your University ID
myNum eval inputEnter 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:
Number is NOT PRIME
Enter a number:
Number is PRIME
Enter a number:
Number is not allowed
Hints:
A prime number can only be divided by itself and Use the modulus operator to check if the number.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started