After the player has finished the game, ask if they'd like to play again. If so, restart the game with a new random number, without changing the range of possible numbers that was originally entered by the player. After the player finishes each game, show statistics on the lowest, highest, and average number of guesses taken by the player over all games played.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

I need this in Python

Modify your guessing-game.py program from the previous lab as follows:
• After the player has finished the game, ask if they'd like to play again. If so, restart the
game with a new random number, without changing the range of possible numbers that
was originally entered by the player.
• After the player finishes each game, show statistics on the lowest, highest, and average
number of guesses taken by the player over all games played.
The other features (how the game works, input validation, etc.) should be unchanged.
Example program run (underlined parts indicate what the user enters)
Let's set up our guessing game!
I'll pick a random integer between a certain min and max (inclusive)
that you specify.
Min: 2
Max: 4
OK, let’s play!
I'm thinking of an integer between 2 and 4, inclusive.
Enter your guess: 2
Woohoo, you got it!
You should consider a career in the psychic industry.
It only took you 1 try.
Your stats so far:
Minimum guesses taken: 1
Maximum guesses taken: 1
Average guesses taken: 1.0
Play again? (Y for yes, anything else for no): Y
OK, let’s play!
I'm thinking of an integer between 2 and 4, inclusive.
Enter your guess: 4
Too high! Try again...
Enter your guess: 3
Woohoo, you got it!
It only took you 2 tries.
Your stats so far:
Minimum guesses taken: 1
Maximum guesses taken: 2
Average guesses taken: 1.5
Play again? (Y for yes, anything else for no): N
2.
Transcribed Image Text:Modify your guessing-game.py program from the previous lab as follows: • After the player has finished the game, ask if they'd like to play again. If so, restart the game with a new random number, without changing the range of possible numbers that was originally entered by the player. • After the player finishes each game, show statistics on the lowest, highest, and average number of guesses taken by the player over all games played. The other features (how the game works, input validation, etc.) should be unchanged. Example program run (underlined parts indicate what the user enters) Let's set up our guessing game! I'll pick a random integer between a certain min and max (inclusive) that you specify. Min: 2 Max: 4 OK, let’s play! I'm thinking of an integer between 2 and 4, inclusive. Enter your guess: 2 Woohoo, you got it! You should consider a career in the psychic industry. It only took you 1 try. Your stats so far: Minimum guesses taken: 1 Maximum guesses taken: 1 Average guesses taken: 1.0 Play again? (Y for yes, anything else for no): Y OK, let’s play! I'm thinking of an integer between 2 and 4, inclusive. Enter your guess: 4 Too high! Try again... Enter your guess: 3 Woohoo, you got it! It only took you 2 tries. Your stats so far: Minimum guesses taken: 1 Maximum guesses taken: 2 Average guesses taken: 1.5 Play again? (Y for yes, anything else for no): N 2.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education