Question: Write a Python program (prime_numbers.py) that checks if a given number is a prime number or not. Your program should repeat asking the user for

Write a Python program (prime_numbers.py) that checks if a given number is a prime number or not. Your program should repeat asking the user for a number, until the user enters a negative number.

Your program should contain two functions:

(1) is_prime(num): This function takes in an int and as parameter, and return True or False. The function tests the int passed to it, if it is a prime number, the function should return True; otherwise, return False. (Submit for 4 points)

(2) __main__: In the main, you should do the following: (Submit for 6 points)

a. Print instruction statement that says: "This program checks if a given number is a prime number"

b. Prompt the user to input a number, int.

c. Check the number entered is not negative and call the function is_prime. Based on the result of is_prime, you program should either "is a prime number" or "is not a prime number".

d. When the user is done, print the following statement "Done. Thanks for using the program!"

Here are some example runs of the program:

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 Databases Questions!