Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro PowerShell For Database Developers

Authors: Bryan P Cafferky

1st Edition

1484205413, 9781484205419

More Books

Students also viewed these Databases questions

Question

1. Communicating courses and programs to employees.

Answered: 1 week ago

Question

6. Testing equipment that will be used in instruction.

Answered: 1 week ago