Question
#Python program to check if numbers in range are prime! '''The assignment is to implement a program that accepts input from a user in the
#Python program to check if numbers in range are prime!
'''The assignment is to implement a program that accepts input from a user in the form of a lower_bound number and an upper_bound number.
You can use what i've included below as a guide or implement your own solution (as long as you demonstrate your understanding of Python control structures throughout the program)
You must annotate your code and explain what each block accomplishes. For example:
#Get lower_bound from user
lower_bound = int(input("Lower Bound: "))'''
#You should check several conditions.
# make sure the lower_bound number is greater than 1.
# if the lower_bound number is not greater than 1, keep prompting the user until the condition is True. In other words you would continue returing to the begining of the loop.
# once the condition for the lower_bound is True, prompt the user to enter a number for the upper_bound that is greater than or equal to the lower_bound number.
# if the upper_bound input is False, keep prompting the user to enter the correct value. No need to continue here. You can simply keep printing an error message and keep asking for an upper_bound number.
# Once you have your input from the user, break out of the loop. Perhaps flipping a boolean flag to False.
# Once out of the loop, print the numbers that the user entered to the console.
# Next you'll want to take each number in the range and check to see if it's prime or not.
# if not prime break
# if prime print to console
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