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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started