Question: Python: I need help so bad!!!! Thank you Prime Number Checker: You will write a program that finds and prints all the factors of a

Python: I need help so bad!!!!

Thank you

Prime Number Checker:

You will write a program that finds and prints all the factors of a given number and checks whether it is a prime number.

Specifically,

Write a function calledgetFactorsthat takes a number as a parameter, calculates all its factors and returns them in a list. Hint: a number F is a factor of number N if N is divisible by F. e.g. 3 is a factor of 6 because 6 is divisible by 3 (6 % 3 == 0) Use a for-loop to go through all the numbers less than given number N. Use the % operator to check divisibility.

Your main program

Asks user for a positive number strictly between 1 and 5000.(NO NEED TO VALIDATE THE INPUT)

Calls thegetFactorsfunction and gets the list of factors.

Prints all the factors, and the total count of factors.(See the sample run below)

Next checks if the given number is prime. A prime number is only divisible by two factors (1 and itself). For example, 7 is a prime number because it is only divisible by 1 and 7, but 12 is not a prime number because it is divisible by 1,2,3, 4, 6 and 12.

Next asks user if the program should continue.

If user enters y, repeats steps 1-5

Else exits.

See the sample run

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!