Question: Question 1: (25 points) Write well-documented Python program to calculate the number of prime numbers: A Prime Number is an integer which is greater than

Question 1: (25 points) Write well-documented Python program to calculate the number of prime numbers: A Prime Number is an integer which is greater than one, and whose only factors are 1 and itself. Numbers that have more than two factors are composite numbers. The first few prime numbers are 2, 3, 5, 7, 11, 13, 17, 19, 23 and 29. The number 1 is not a prime number. Write a well-documented, Python program - the main program, that accepts both a lower and upper integer from user entries. Construct a function, isPrime(n), that takes an integer (n) and returns a Boolean value of True if the number is indeed prime. If not, your function should return False. Inside your main program, with isPrime, use a for loop and a counter to increment every time a prime number is found between the lower and upper limits. Also, store that prime number onto a list, myPrimeList. One way to do this is to initialize the list, myPrimeList with the construct myPrimeList before the loop. Inside the for loop, append the number to the list if it is prime Submit your program as a text file prime.py. Include as a comment the answer to the question, " How Many Primes Are Between 4568 and 19,954?" Hints: Logic For the isPrime Function is shown below. The terms in the column are candidate primes to test. The term:s along the top row are the divisors. 10 12 13 2 TRUE TRU TRUE TRUE FALSE FALSE TRUE TRUE FALSE TRUE FALSE RUE FALSE FALSE FALSE 9FALSE FALSE FALSE FALSE TRUE 10 12 RUE ALSE TRUE ALSE FALSE FALSE FALSE RUE 13 TRUE TRUE a true with a divisor that is not the candidate prime number- your code does not need to continue to process, it can return Boolean False TRUE a true that occurs when the divisor candidate prime number
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
