Question: Write a python program that requests a positive integer from the user, determines if it is a prime, composite or neither prime or composite and

Write a python program that requests a positive integer from the user, determines if it is a prime, composite or neither prime or composite and prints the message.

You can choose to use iterative loops to repeatedly run this script or have the user run the script for every input. Please specify instructions to run the code in markdown language above the code cell.

Sample runs are shown below:

Enter positive integer: 3

It is a prime

Enter positive integer: 4

It is a composite

Enter positive integer: 1

It is neither prime nor composite

Enter positive integer: -5

Error: You did not enter a positive integer

Enter positive integer: Hi

Error: You did not enter a positive integer

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!