Question
Write a simple guessing game using the following specifications: Generate a random number between 1 and 1000 Ask the player to guess the number. You
Write a simple guessing game using the following specifications:
Generate a random number between 1 and 1000
Ask the player to guess the number. You will keep track of the number of guesses.
If the players guess is higher than the number generated then display the message Too High! If the players guess is within a 10-point difference of the number generated but higher than the number generated, then print the message Getting warm but still high
If the players guess is lower than the number generated then display the message:Too Low If the players guess is within a 10 point difference of the number generated but lower than the number generated, then give the message Getting warm but still Low!
The program will keep taking guesses until the player guesses the number.
Once the player guesses the number, give them a congratulatory message like You rock! You guessed the number in x tries! where x is the actual number of tries it took this player to guess the number. You can write any message as long as you include the number of tries in the message.
Once the player has guessed the number, ask them if they wish to pay again. If they do, then generate another random number and tart the game over again.
All input to the program will be interactive from the keyboard.
Step 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