Question: Implement a number guessing game where a player will get up to seven chances to guess a mystery number in the range of 1 through
Implement a number guessing game where a player will get up to seven chances to guess a mystery number in the range of through
At the beginning of the game, the program will generate a random number in the range through It will then prompt the player to guess the number. If the users guess is:
Higher than the random number the program will display Too High
Lower than the random number the program will display Too Low
The same as the random number the program will congratulate the player.
The program allows up to seven rounds per game. The player can play as many games as they wish.
The following functions must be included in the implementation. They will be called from main:
getGuessfirst last
Prompt user for a number in the range first to last inclusive and return it
Input Validation. Make sure that the number entered is in the range firstlast Loop until valid.
guessWinnumber guess
Compare the mystery number against the players guess.
If guess number display Too High
If guess number display Too Low
If guess number congratulate player
Return True if the player guessed the mystery number, False otherwise.
Note
Define the number of rounds per game as a constant so it can easily be adjusted to make the game more or less challenging.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
