Question: Kindly use Python programming . Please share code and picture of output as shown in the question instruction (to help with understanding) 04.4 - Prime
Kindly use Python programming. Please share code and picture of output as shown in the question instruction (to help with understanding)
04.4 - Prime Numbers A prime number is a number (not including 1 ) that is only evenly divisible by two numbers: itself and 1. For example, the number 5 is prime because it can only be evenly divided by 1 and 5. The number 6 , however, is not prime because it can be divided evenly by 1,2 , 3 , and 6 . Write a Boolean function named is_prime which takes an integer as an argument and returns True if the argument is a prime number, or False otherwise. Then, in the main function, prompt the user to enter a number. If the user enters 1, end the program. Otherwise, display a message indicating whether or not the number is prime, usingyour is_prime function to decide which message to display. Table 1: Test data for Exercise 04.4. Test your program with the data in Table 1. Finally, format your program to match the sample output, character for character, including all white space and punctuation. User input in the sample has been highlighted in Pappy's Purple to distinguish it from the program's output, but your user input does not need to be colored. Save your finished Python program as prime_numbers_login. py, where login is your Purdue login. Then submit it along with a screenshot showing a run of all 5 test cases. Terminal \$ python prime_numbers_login. py Enter a positive integer ( 1 to quit): 1 1 is not prime. Enter a positive integer (-1 to quit): 2 2 is prime! Enter a positive integer ( 1 to quit): 10 10 is not prime. Enter a positive integer (-1 to quit): 4001 4001 is prime! Enter a positive integer ( 1 to quit): 1 $
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
