Write a python program that asks the user to guess a number


Assignment: Guess the Number

For this assignment you will be writing a program from scratch! Follow the directions posted below.

Level 1. Write a Python program that asks the user to guess a number between 0 and 100 and give feedback that tells the user the guess was too high or too low until they correctly guess the number.

Level 2. After the user correctly guesses the number, add output telling the user how many guesses it took.

Level 3. The range for guessing changes after each guess. For example if the user's first guess is 50 and the feedback is that the guess was to high, the next guess should be between 0 and 50. To help the user, update the new range for the guess every time they are asked for another guess.

Level 4. What if the user accidentally types a number that is not within then range? Provide feedback that the guess was outside the range and then do not change the range for the guesses when prompted for another guess. Let's also not count a guess outside the range in their total number of guesses.

Level 5. After the user correctly guesses the number, ask if they would like to play again. If the first letter of their response is 'y' or 'Y' start over with a range from 0 to 100 again. Hint: Put your current loop that gets user guesses inside another loop that starts the game over again.

Level 6. Each time the user guesses the correct number include feedback giving the fewest number of guesses needed to correctly guess the number (low/best score). Hint: You can initialize the low score at a really high number like 100 guesses.

Below is an example of the output for this game.
Welcome to Guess the Number!
Please enter your guess between 0 and 100. 50 Too low.
Please enter your guess between 50 and 100. 25 Your guess is not between 50 and 100.
Please enter your guess between 50 and 100. 75 Too low.
Please enter your guess between 75 and 100. 85 Too high.
Please enter your guess between 75 and 85. 80

Congratulations. You guessed the number in 4 guesses! Your low score is 4 guesses.

Would you like to play again? yes
Please enter your guess between 0 and 100. 20 Too high.
Please enter your guess between 0 and 20. 3

Congratulations. You guessed the number in 2 guesses! Your low score is 2 guesses.

Would you like to play again? no

Request for Solution File

Ask an Expert for Answer!!
Python Programming: Write a python program that asks the user to guess a number
Reference No:- TGS02300451

Expected delivery within 24 Hours