Question: Question Goal: Learn how to use sentinels in while loops to control when to exit. Assignment: A quite different way of using sentinels is to

Question
Goal: Learn how to use sentinels in while loops to control when to exit.
Assignment: A quite different way of using sentinels is to write guessing games. The sentinel becomes the value you need to guess. The game should keep going until the user guesses the right value.
lower than right_value. At the end, the program should display the number of guesses the player made.
Note: Take a look at the sample run. Make sure your program's prompts and messages are the same.
Sample Run (User input enclosed in >)
Enter a guess: 1>
Your guess is too low.
Enter a guess: 50>
Your guess is too high.
Enter a guess: 22>
Your guess is too low.
Enter a guess: 27>
Correct! It took you 4 guesses.
Your guess ; is too low.
Enter-a guess: 27>
Question Goal: Learn how to use sentinels in

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!