Question: Design and write a modular python program for chapter 7 programming exercise # 1 2 from your textbook, with the following modifications: prompt for input
Design and write a modular python program for chapter programming exercise # from your textbook, with the following modifications:
prompt for input of a positive number and call a function to determine if all the numbers from up to and including the input number is a prime or composite number
display all the numbers tested with the appropriate label prime or composite
after completing the task of displaying the numbers the program should ask for a second number input
entry of a negative number will end the program
Follow the program coding requirements found in the lab rubric.
Prime Number Generation
A positive integer greater than is said to be prime if it has no divisors other than and itself. A positive integer greater than is composite if it is not prime. Write a program that asks the user to enter an integer greater than then displays all of the prime numbers that are less than or equal to the number entered. The program should work as follows:
Once the user has entered a number, the program should populate a list with all of the integers from up through the value entered.
The program should then use a loop to step through the list. The loop should pass each element to a function that displays whether the element is a prime number, or a composite number.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
