Answered step by step
Verified Expert Solution
Question
1 Approved Answer
6. Guess the Number Game Write a program that allows a user to play the guessing game. Select the range of valid numbers - (i.e.
6. Guess the Number Game Write a program that allows a user to play the guessing game. Select the range of valid numbers - (i.e. guess a number from 1 -20). Generate a random number within this range as the answer. Hint: print the answer so you know it for your testing. Continue playing (aka looping) until they guess the correct answer. Prompt the user for a guess. If their number is higher than the answer, display a message letting them know the correct answer is lower. If their guess is too low, display a message. Include range validation for their guess. You'll need a counter variable to keep track of the tries needed to guess the correct number. When the user matches the answer, display a congratulations message and let them know how many tries it took
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started