Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

write this program in python Short Description You will be implementing a guessing game where a player must guess a letter that is randomly generated

write this program in python

Short Description

You will be implementing a guessing game where a player must guess a letter that is randomly generated by the computer. The player has unlimited guesses, and every time the player makes a guess, the computer will provide feedback about whether the guess was too high, too low or correct.

Version 1

Write a program to guess the computers randomly chosen letter until you guess it correctly. Your program should:

  • Display the instructions for the game before the player begins playing.

  • Randomly generate a letter between a and z.

  • Continuously ask for the user to guess a letter until they guess correctly. Any guess entered that is not a letter between a and z is an invalid input.

  • Provide feedback after every guess telling the player whether the guess was too high, too low, correct or invalid.

Sample Run:

Welcome to Guessing Game!

This is a simple game where you will have to guess a secret letter.

After each game you can check under 'MY STATS' to see how you did!

I am thinking of a letter between a and z.

Take a guess: A

Your guess is too low.

Take a guess: r

Your guess is too high.

Take a guess: g

Your guess is too high.

Take a guess: D

Your guess is too high.

Take a guess: b

Your guess is too low.

Take a guess: 2

Invalid input

Take a guess: c

Good job, you guessed the correct letter!

Version 2

Modify your program so that in addition to all it currently does, it tracks the number of guesses and the worst letter guess during the game and prints them after the game is over under the heading My Stats.

The worst letter guess is the letter whose position is farthest away from the position of the answer. For example, if the correct answer is a and the player guesses c and z, then the worst letter guess would be z since it is farthest away from a. Your program should display this guess unless the user guessed the answer in their first attempt. Only valid inputs entered by the user should be considered when determining the worst letter guess.

The number of guesses is the number of incorrect and correct guesses made during the game. When you display their number of guesses, also display a "ranking label". If their number of guesses is below 5, they are labelled an expert, if their number of guesses is between 5 and 10, they are labelled an intermediate, if their number of guesses is above 10, they are labelled a beginner.

Sample Run 1:

Welcome to Guessing Game!

This is a simple game where you will have to guess a secret letter.

After each game you can check under 'MY STATS' to see how you did!

I am thinking of a letter between a and z.

Take a guess: D

Your guess is too low.

Take a guess: m

Your guess is too high.

Take a guess: g

Your guess is too high.

Take a guess: e

Good job, you guessed the correct letter!

---MY STATS---

Number of Guesses: 4

Level: Expert

Worst Letter Guess: m

Sample Run 2:

Welcome to Guessing Game!

This is a simple game where you will have to guess a secret letter.

After each game you can check under 'MY STATS' to see how you did!

I am thinking of a letter between a and z.

Take a guess: a

Good job, you guessed the correct letter!

---MY STATS---

Number of Guesses: 1

Level: Expert

Worst Letter Guess: not available

Sample Run 3:

Welcome to Guessing Game!

This is a simple game where you will have to guess a secret letter.

After each game you can check under 'MY STATS' to see how you did!

I am thinking of a letter between a and z.

Take a guess: f

Your guess is too low.

Take a guess: 6

Invalid input

Take a guess: r

Your guess is too low.

Take a guess: v

Your guess is too low.

Take a guess: x

Good job, you guessed the correct letter!

---MY STATS---

Number of Guesses: 5

Level: Intermediate

Worst Letter Guess: f

Version 3

Enhance the program so that a player can play multiple times. After each round of the game, they should be asked whether or not they want to play again.

Sample Run:

Welcome to Guessing Game!

This is a simple game where you will have to guess a secret letter.

After each game you can check under 'MY STATS' to see how you did!

I am thinking of a letter between a and z.

Take a guess: d

Your guess is too low.

Take a guess: m

Your guess is too low.

Take a guess: r

Your guess is too low.

Take a guess: x

Your guess is too high.

Take a guess: u

Your guess is too low.

Take a guess: w

Good job, you guessed the correct letter!

---MY STATS---

Number of Guesses: 6

Level: Intermediate

Worst Letter Guess: d

Would you like to play again? Y/N y

I am thinking of a letter between a and z.

Take a guess: d

Your guess is too low.

Take a guess: l

Your guess is too high.

Take a guess: g

Good job, you guessed the correct letter!

---MY STATS---

Number of Guesses: 3

Level: Expert

Worst Letter Guess: l

Would you like to play again? Y/N n

Version 4

After the player decides not to continue playing the game, a summary statistics page should be displayed. This summary statistics is only displayed once they finish playing the game (meaning they answer No to the question Do you want to play again?), there should be an overall summary of their statistics based on all rounds of the game played in a single run of the program. The following must be displayed in the summary statistics:

  • Highest Number of Guesses: Out of all the games they have played, track the highest number of guesses to get to the correct answer and display it.

  • Lowest Number of Guesses: Out of all the games they have played, track the lowest number of guesses to get to the correct answer and display it. This will be 1 if they guess the answer in the first attempt.

  • Average Number of Guesses: Out of all the games they have played, track the number of guesses to get to the correct answer and display the players overall average number of guesses.

  • Overall Level: The players level of expertise (expert, intermediate or beginner) based on their average score.

Sample Run:

Welcome to Guessing Game!

This is a simple game where you will have to guess a secret letter.

After each game you can check under 'MY STATS' to see how you did!

I am thinking of a letter between a and z.

Take a guess: a

Your guess is too low.

Take a guess: r

Your guess is too high.

Take a guess: g

Your guess is too low.

Take a guess: m

Your guess is too high.

Take a guess: j

Good job, you guessed the correct letter!

---MY STATS---

Number of Guesses: 5

Level: Intermediate

Worst Letter Guess: a

Would you like to play again? Y/N y

I am thinking of a letter between a and z.

Take a guess: b

Your guess is too low.

Take a guess: l

Good job, you guessed the correct letter!

---MY STATS---

Number of Guesses: 2

Level: Expert

Worst Letter Guess: b

Would you like to play again? Y/N n

---SUMMARY STATS---

Lowest Number of Guesses: 2

Highest Number of Guesses: 5

Average Number of Guesses: 3.5

Overall Level: Expert

write this program in python

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

=+65-1 Explain how we draw the line between normality and disorder.

Answered: 1 week ago

Question

Explain the various methods of job evaluation

Answered: 1 week ago

Question

Differentiate Personnel Management and Human Resource Management

Answered: 1 week ago

Question

Describe the functions of Human resource management

Answered: 1 week ago