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 1 through 100.

At the beginning of the game, the program will generate a random number in the range 1 through 100. It will then prompt the player to guess the number. If the user's 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():

  • getGuess(first, 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 [first,last]. Loop until valid.
  • guessWin(number, guess)
    Compare the mystery number against the player's 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.

Output Samples

The text version of the Output Samples for the day of the week Program

Input Validation

The text version of the Input Validation for the day of the week Program

Grading Rubric

guessNumber.py

Program documentation & IPO Chart

10

Generate Random Number

10

Play Game

30

Constant definition

 

Prompt user for guess

 

Display high/low/win

 

Play as many games as the user wishes

10

Functions

 

getGuess(first, last)

Documentation

Parameters

Return value

Functionality

20

guessWin(number, guess)

20

Documentation

Parameters

Return

Functionality

 

Make sure code is correct using python and that you create the IPO chart and follow the chart all the way at the bottom.

 

guessNumber.py

 


Step by Step Solution

3.50 Rating (153 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Python import random Constants MAXROUN... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!