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
X = 10<br> y = 20<br> x &gt; y<br> print("if statement")<br> print("else statement")
Eduardwww [97]
I dont really understand what you want to do but im gonna answer it as if I understood it.

If x is 10 and y is 20 then y is larger than x
8 0
3 years ago
Which task can a company perform with intranets
Irina-Kira [14]

Answer:

C.) store data securely would be my choice

Hope This Helps!  Have A Nice Day!!

6 0
2 years ago
Is the following statement true or false?
Alchen [17]

Answer:

The following statement is True.

Explanation:

Because when we are applying the pair t-test then, take differences of that pair and then treat it as an individual samples. Formula for the test is a statistic and in this case, it is also same as formula in the one-sample of t statistics.

Therefore, it will be an equivalent to the one-sample t-test.

6 0
2 years ago
William brought some data into his Tableau Book, but the data had some null values and incorrect column headers. What did Willia
ozzi

William  had to manually edit the data if he wants to remove the null values and incorrect column headers.

<h3>What is data editing?</h3>

Data editing is known to be a term that connote the act of making changes, reviewing or adjustment  some survey data.

Note that by editing one can remove want one do not want from a group of data and as such,  William  had to manually edit the data if he wants to remove the null values and incorrect column headers.

Learn more about data from

brainly.com/question/26711803

#SPJ1

6 0
1 year ago
What Is an Antivirus?
wariber [46]
Antivirus software, or anti-virus software, also known as anti-malware, is a computer program used to prevent, detect, and remove malware. Antivirus software was originally developed to detect and remove computer viruses, hence the name.
8 0
3 years ago
Read 2 more answers
Other questions:
  • What Is the output of the following: =OR (5 &lt;7, 16*Rand ()&gt;23,FALSE)
    5·1 answer
  • How to see the range of values of vty lines?
    15·1 answer
  • Rapid development programming languages eliminate the possibility of having bugs in code. True or False
    8·1 answer
  • How can you have a safe browser experience
    9·1 answer
  • YOU WANT TO DISCARD YOUR OLD COMPUTER AND WANT TO SECURELY ERASE THE DATA FROM YOUR HARD DRIVE. WHAT SOFTWARE CAN YOU USE AND WH
    9·2 answers
  • A wireless network does not benefit like a wired network does, when it comes to collision reduction. Which device reduces collis
    6·1 answer
  • what social media application that affect our day to day activities, and how did it improve our skill
    9·1 answer
  • To specify your preferred colors, fonts, and effects for a document, which of the following should be done?
    5·2 answers
  • Answer for 5,6,7 any one know plz
    8·1 answer
  • What feature preserves your open apps and data, but allows another user to log in to his or her own session of the same computer
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!