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
vichka [17]
3 years ago
6

Write a program in python to test if given number is prime or not.

Computers and Technology
2 answers:
Lerok [7]3 years ago
7 0

num = int(input("Enter a number to test if it's prime or not: "))

if num%2 == 0:

   if num == 2:

       print(num,"is prime")

   else:

       print(num,"is not prime")

else:

   count = 0

   for x in range(2,num):

       if num % x == 0:

           count+=1

   if count==0:

       print(num,"is prime")

   else:

       print(num,"is not prime")

I wrote my code in python 3.8. I hope this helps!

Paraphin [41]3 years ago
4 0

Answer:

Answer:

def main():

num = int(input("Input a number to check for prime: "))

if num > 1:

 for i in range(2,num):

  if (num % i) == 0:

   print("%d is not a prime number" % num)

   break

  else:

   print("%d is a prime number" % num)

   break

else:

 print("%d is not a prime number" % num)

 

if __name__ == "__main__":

main()

Explanation:

Solution retrieved from programiz.com.

Note, this program uses the idea of the Sieve of Eratosthenes to validate the input number by using the modulo operator to determine primeness.

The program will output to the user if the number input is indeed prime or not.

Cheers.

Explanation:

You might be interested in
USB flash drives are small portable units that are used to ____________files.
Juliette [100K]

Answer:D

Explanation: they do all of these

3 0
4 years ago
Read 2 more answers
A technician is installing RG6 cable and asks you to retrieve a connector from the parts drawer. What type of connector do you n
Bezzdna [24]

The type of connector, which is needed when a technician is installing RG6 cable and asks to retrieve a connector from the parts drawer, is F-connector.

<h3>What is F-connector?</h3>

The F-connector is a type of RF connector which is used to connect the Video equipments to the antennas and setup box.

A technician is installing RG6 cable.

  • The RG6 cable is a coax cable.
  • This cable is used in satellite signal transmission, generally for TV and setup box.

Now the technician is ask to retrieve a connector from the parts drawer. Here, we use F type connector for this RG6 cable.

Thus, the type of connector, which is needed when a technician is installing RG6 cable and asks to retrieve a connector from the parts drawer, is F-connector.

Learn more about the connector cable here

brainly.com/question/9082842

#SPJ1

4 0
2 years ago
A consumer-directed digital or computer device that has a video output signal for displaying a video game is called a .......
Allushta [10]
I think the first problem is B. and the second problem is D.
4 0
4 years ago
Ashley works for a company that helps hospitals hire new doctors. They have written a list of strategies that can be used to int
enyata [817]

Answer:

A file.

Explanation:

A file can be defined as a computer resource used for the collection of data (informations) as a single unit.

Basically, files are of different types or in various formats (forms) and these includes document, video, audio, image, software application, data library etc.

Additionally, various operations such as open, close, edit, format, delete, save, rename, compress etc. can be performed on a file through the use of specific software applications or programs.

In this scenario, Ashley wants to give a list of strategies that can be used to interview doctors to their supervisor to review.

Hence, what Ashley should give to the supervisor to do a review is a file.

6 0
3 years ago
A technician would like to have the ability to add physical hard drives to a Storage Spaces storage pool at future times on an a
zavuch27 [327]

Answer:

b. Thin provisioning

Explanation:

Thin provisioning is a storage space feature that makes allocating disk storage space flexible based on the space needed by each user, it improves the way storage space is utilized.

4 0
3 years ago
Other questions:
  • Create a Flash Card class. Flash Cards have a Question and an Answer, each of which are Strings. Your class should include a con
    6·1 answer
  • Which of the following statements is false? A constructor is similar to a method but is called implicitly by the new operator to
    6·1 answer
  • Who predicted nearly 60 years ago that the rise of electronic media would create a "global village," thereby reducing the barrie
    12·1 answer
  • When reading events in the Event Viewer, you need to recognize the designated levels or classifications. Which of the following
    9·1 answer
  • A browser allows you to set preferences for using the browser. These preferences include all of the following except
    7·1 answer
  • Complete the function by filling in the missing parts. The color_translator function receives the name of a color, then prints i
    11·1 answer
  • How many centimeters are there in 1 meters
    13·2 answers
  • Mention some of the codes of conduct of Information Technology (IT)​
    11·1 answer
  • Which securities protect data through processes, procedures,decisions,and user pernissions. Determines where and how data can be
    13·1 answer
  • you have just finished developing a new application. before putting it on the website for users to download, you want to provide
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!