1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Alexus [3.1K]
3 years ago
8

Write a python program that requests a positive integer from the user, determines if it is a composite, a prime 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.
Computers and Technology
1 answer:
Serjik [45]3 years ago
3 0

Answer:

num = int(input("Num: "))

if num > 1:

    for i in range(2,num):

         if (num % i) == 0:

              print(num,"is a composite number")

              break

         else:

              print(num,"is a prime number")

else:

    print(num,"is neither prime nor composite")

Explanation:

This line prompts user for input

num = int(input("Num: "))

The following if condition check for prime, composite or neither both

if num > 1:

The following iteration checks for prime or composite

    for i in range(2,num):

This if condition tests if a valid divisor can be gotten. If yes, then input number is composite

<em>          if (num % i) == 0: </em>

<em>               print(num,"is a composite number")</em>

<em>           break</em>

<em />

If otherwise, then input number is prime

<em>          else:</em>

<em>               print(num,"is a prime number")</em>

<em />

All numbers less than 2 are neither composite nor prime

else:

    print(num,"is neither prime nor composite")

You might be interested in
Decrypt this secret message if your able to a lot will come..
nata0808 [166]

Answer:-

Failure

and 0008

Hope This Helps

7 0
2 years ago
Read 2 more answers
Why is code tracing important when debugging?
larisa [96]

It helps reveal the flow of execution of your program, including results of in-between evaluations. In other words, you can see what your program is doing, and why it takes the decisions it is taking.

If something unexpected happens, the trace will show you the sequence of events that lead to it.

7 0
3 years ago
How long does food remain in the small intestine?
kow [346]

About six to eight hours

7 0
3 years ago
State the major different between fours types of computers
Igoryamba

Answer:

1. Supercomputers

Supercomputers are very expensive and very fast. They are the most powerful computers we have in the world.

Supercomputers are optimized to execute only a small number of programs. This makes it possible for them to execute these few programs at a very high speed. Due to their inhibiting cost, they are used in high-end places like in scientific research centers. The supercomputer consists of thousands of processors, allowing it to clock in at very high speeds measured by petaflops.

These computer types are also very large in size due to the numerous parts and components involved in their design.

A good example of a supercomputer is Tianhe-2, which is located in the National Supercomputer Center in Guangzhou, China. It features 3.12 million cores, allowing it to run at speeds of 33.86 petaflops.

2. Mainframe Computers

These are large and expensive computers that are capable of supporting thousands of users simultaneously. They are mostly used by governments and large organizations for bulk data processing, critical applications, and transaction processing. They are ranked below supercomputers.

3. Minicomputers

Minicomputers are mid-sized computers. In terms of size and power, they are ranked below mainframes. A minicomputer is a multiprocessing system capable of supporting from 4 to about 200 users simultaneously.

The use of the term minicomputer has diminished since the introduction of microprocessors. These machines are now more commonly called midrange computers.

4. Microcomputers

A microcomputer, also known as a personal computer, is designed to be used by one user at a time. The term microcomputer relates to the microprocessor that is used for the purpose of processing data and instruction codes. These are the most common computer types since they are not very expensive

8 0
2 years ago
Fredrico has to lead a training for his company. He wants to include a visual element to help engage his audience. What type of
andreyandreev [35.5K]
Presentation software is probably his best option. It would allow him to present visual and audio supplements to his audience.
8 0
3 years ago
Read 2 more answers
Other questions:
  • What happens when the computer is thrashing? quizzlet?
    12·1 answer
  • Some financial institutions can be really bad about putting unexpected charges
    12·1 answer
  • The angles of a quadrilateral are in the ratio 1:2:3:4 what is the largest angle​
    5·1 answer
  • Suppose we provide a new implementation of the transport layer protocol tcp providing the same functionality using different alg
    14·1 answer
  • "In a web app, where is data usually stored? A. Mobile network B. Application storage C. Local computer D. Cloud storage"
    14·1 answer
  • Upon connecting to a Wi-Fi network, you're redirected to a login screen and a request to accept terms of service before being co
    15·1 answer
  • Use the drop-down menus to complete statements about archiving and backing up data fileArchiving data files manages the size of
    5·2 answers
  • Importance of computer education​
    9·1 answer
  • The average American has 10 devices, ask for users average number of devices. Any number between 7 and 12 will print “you have a
    13·1 answer
  • When right-clicking an object, a ____ menu appears, which contains frequently used commands related to the object.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!