Question: Final Exam Part I ( 3 0 exam points ) Write a complete program to let the user play a guess a number between 1

Final Exam Part I (30 exam points)
Write a complete program to let the user play a "guess a number between 1 and 100" guessing game with the computer. If the user does not guess correctly
then the computer will update the boundaries using the last guess as one of the new boundaries.
When the user finally guesses the number, the computer should acknowledge this and also display the number of valid guesses that the user made. When the
user finally chooses not to play anymore, the program should print out a message with the best round played.
Below you will find an example run. Note that you must print out the correct answer each time before the user starts making guesses, so that I can verify
that the program is correctly winnowing down the search space. Failure to do so results in zero "functions correctly" points, and is guaranteed to drag some not-
insignificant number of design points with it.
Finally, this is officially part of your final exam. This is individual effortno help from anyone beyond the course instructor(s) and lab assistants. We will
answer clarifying questions, point to the general location of errors, etc, but little else.
Welcome to the Guessing Game!
(answer is 86)
Guess a number between 1 and 100: 42
Too low!
Guess a number between 42 and 100: 7
Your guess must be between 42 and 100.
Guess a number between 42 and 100: Bob
Your guess must be a number.
Guess a number between 42 and 100: 75
Too low!
Guess a number between 75 and 100: 90
Too high!
Guess a number between 75 and 90 : 83
Too low!
Guess a number between 83 and 90 : 86
You guessed it!
It only took you 5 guesses.
Play again? (Y/N): Y
(answer is 37)
Guess a number between 1 and 100: 50
Too high!
Guess a number between 1 and 50: 25
Too low!
Guess a number between 25 and 50: 37
You guessed it!
It only took you 3 guesses.
Play again? (YN
Thanks for playing!
Your best round was 3 guesses.
 Final Exam Part I (30 exam points) Write a complete program

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!