Question: Reading An Integer This function takes care of the common task of asking the user to enter a number and using int to convert:It's also

Reading An Integer
This function takes care of the common task of asking the user to enter a number and using int to convert:It's also fairly common to want the user to enter a number in a specific range. For example, in the guessing game from assignment 1 question 4, you are asking the user to enter a number 1-100.
Improve the function read_integer in a file read. py so that takes three arguments: the prompt, a lower bound, and an upper bound on allowable numbers. The function should ask the user to enter values, until they enter one in the given range.
For example, calling read_integer("Enter your guess", 1,100) would produce user interaction like this:In this case, the function should return 12.
 Reading An Integer This function takes care of the common task

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!