Question: Write a Python program that a ) Asks the user for an integer greater than 1 7 and less than 7 0 . If the

Write a Python program that
a) Asks the user for an integer greater than 17 and less than 70. If the user input does not lie between 17 and 70, print a message letting them know whether their input was less than 17 or greater than 70, and ask the user for a number again. Keep repeating this until they enter a number within the given range.
Accomplish this with a single input statement and boolean variables
b) Calculates all prime numbers below the user-entered number, takes the square root of each of the primes, up to 3 places after the decimal, and stores all the roots in an array
Look up the math library operator that can help you finding square roots, and how you can limit the number of decimal places
Review nested loops that may be useful here
Do not use Python built-in functions to find prime numbers
c) Ask the user for a number and print all the square roots stored in the array that are below that number
E.g. If user enters 3 this time, it prints all the square roots that are less than 3. If there is no root less than 3, it needs to print that and let the user know.
Parts (a),(b), and (c) should be executed in order, (b) starting only after (a) is done and (c) starting only after (b) is done, in the same code.

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!