Question
xpand I need help with this program, can someone show me step by step how to do it. l need to expand ethe range to
xpand I need help with this program, can someone show me step by step how to do it. l need to expand ethe range to be 1 to 20 and allow the user to get a maximum of 5 attempts to guess it. The game ends when the user has guessed the correct number (a win) or the number of incorrect guesses has reached 5 (a loss). At the end of each game, users should be told whether they won or lost. To make the game more interesting, the program should vary the wording of the messages that it outputs for winning, for losing, and for asking for another game. Create at least 2 different messages for each of these cases, and use random numbers to choose among them.
After printing out the win/loss messages, ask the user whether they want to play again and have them answer 'y' or 'n'. When the user quits with the 'n' answer, the program should output the total number of wins and losses. If they answer 'y', then a new random number should be generated and they will of course, have 5 attempts again to guess the number.
Here's some pseudo code that describes the outerloop of game control.
set answer to 'y'
while the answer is 'y' do the following steps
generate the random number
keep asking for a guess and comparing the guess to the computer's number until they win or have exceeded 5 guesses
print different messages out depending on whether they've won or lost
ask if they want to continue and set the response to the variable "answer"
They don't want to continue so print out the win/loss statistics
#includeStep 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