Question: 7 . 1 7 . 2 : Arrange the code to return an integer value read from the user that is within a given range.

7.17.2: Arrange the code to return an integer value read from the user that is within a given
range.
Arrange the following lines of code for the body of the function readFromUser that continues to read data from the user until an
integer in the given range is read. Use all lines in your solution.
Empty print statements are included for output formatting. Your code will be tested using readFromUser (1,10).
How to use this tool
Unusedexcept ValueError :
if value low or value > high :
try :
print("Error: invalid data type.")
print("Error: value is out of range.")
done = True
while not done :
else :
return value
value = int(input("Enter an integer value: "))
print()readfromuser.py
Load default template...
# Returns an integer value read from the user
# that is within a given range.
# @param low the low end of the valid range
# @param high the high end of the valid range
# @return the valid integer read from the user
#
def readFromUser(low, high) :
7 . 1 7 . 2 : Arrange the code to return an

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 Programming Questions!