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
Click cell C6 in the Data worksheet and insert a column. Type Series Name in cell C6. Click cell C7 in the Data worksheet and in
Rudiy27

Answer:

right click cell C6 then insert entire column.

Type "Series Name"

Insert function to C7 = VLOOKUP (B7,$A$2:$B$4,2,FALSE)

Copy through C22

Select the range then select format and column width to change the width to 18.

7 0
3 years ago
Yall tryna play gta later? I play on ps4
iVinArrow [24]

Answer:

xbox tho

Explanation:

8 0
3 years ago
Read 2 more answers
What type of control structure is the default method of the computer reading code?
Delicious77 [7]
The answer is Selection. Hope this helped you
8 0
3 years ago
Normal or random variations that are considered part of operating the system at its current capability are ______: ​ a. systemic
Effectus [21]

Normal or random variations that are considered part of operating the system at its current capability are <u> c. common cause variations.</u>

Explanation:

Common cause variation is fluctuation caused by unknown factors resulting in a steady but random distribution of output around the average of the data.

Common-cause variation is the natural or expected variation in a process.

Common-cause variation is characterised by:

  1. Phenomena constantly active within the system
  2. Variation predictable probabilistically
  3. Irregular variation within a historical experience base

It is a measure of the process potential, or how well the process can perform when special cause variation removed.

Common cause variation arises from external sources that are not inherent in the process and is where statistical quality control methods are most useful.

Statistical process control charts are used when trying to monitor and control 5- and 6-sigma quality levels.

4 0
3 years ago
What is the process called when programmers look for and fix errors in code? Analysis Debug Document Error check
Sunny_sXe [5.5K]
It’s Debug. definition: “identify and remove errors from (computer hardware or software)”.
4 0
3 years ago
Read 2 more answers
Other questions:
  • Which windows tool is used to determine if a dynamic disk is corrupted?
    6·1 answer
  • What protocol suite below is the most commonly used protocol for local area network (lan) communication?
    8·1 answer
  • Define a romanNumberToInt function that converts a RomanNumber value, which is a list of Roman digits, into an integer. Hints: -
    7·1 answer
  • Which of the following is a popular open source intrusion detection system that runs on SmoothWall?? Synchronous Dynamic Random
    6·1 answer
  • Courteous behavior on the road will
    10·2 answers
  • function calculate () { var s = 2; var x = 2; var y = 3; if (x &gt; 4) { s=s+ 2; } else if ( y &gt; 4) { s=s+ 4; } else { s+=3;}
    11·1 answer
  • Explain the purpose of QoS on a TCP/IP network. Define the basic purpose of IP prece- dence, Type of Service, Diffserv, and Expl
    11·1 answer
  • What is the text that is entered into a cell used to identify the purpose of the worksheet, columns, and rows? a. date and time
    14·1 answer
  • Stuart wants to delete some text from a slide. What should Stuart do?
    8·1 answer
  • Who is your favorite person from squid game?
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!