Problem

Write a program that plays a reverse guessing game with the user. The user thinks of a num...

Write a program that plays a reverse guessing game with the user. The user thinks of a number between 1 and 10, and the computer repeatedly tries to guess it by guessing random numbers. It’s fine for the computer to guess the same random number more than once. At the end of the game, the program reports how many guesses it made. Here is a sample execution:

This program has you, the user, choose a numberbetween 1 and 10. Then I, the computer, will trymy best to guess it.Is it 8? (y/n) nIs it 7? (y/n) nIs it 5? (y/n) nIs it 1? (y/n) nIs it 8? (y/n) nIs it 1? (y/n) nIs it 9? (y/n) yI got your number of 9 correct in 7 guesses.

For an added challenge, consider having the user hint to the computer whether the correct number is higher or lower than the computer’s guess. The computer should adjust its range of random guesses on the basis of the hint.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 5
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT