Problem 49

Keep Guessing

Modify your previous number-guessing game so that they can guess until they get it right. That means it will keep looping as long as the guess is different from the secret number. Use a while loop.

I have chosen a number between 1 and 10. Try to guess it.
Your guess: 5
That is incorrect. Guess again.
Your guess: 4
That is incorrect. Guess again.
Your guess: 8
That is incorrect. Guess again.
Your guess: 6
That's right! You're a good guesser.

◄ 48: Enter Your PIN 50: Dice Doubles ►



Adapted from ProgrammingByDoing.com
©2013 Graham Mitchell

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.