Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

follow the sample output below Write a python program that plays the game of 'guess the number' as follows: Your program should automatically choose a

follow the sample output below image text in transcribed
image text in transcribed
Write a python program that plays the game of 'guess the number' as follows: Your program should automatically choose a random number to be guessed by selecting an integer at random in the range 1 to 1000. Then ask the player to guess the number. The player then types a guess. The program responds with one of the following: 1. Excellent! You guessed the number! Would you like to play again ( 1=yes, 2=no )? 2. Too low. Try again. I 3. Too high. Try again. If the player's guess is incorrect, your program should loop until the player finally gets the number right. Your program should keep telling the player "Too high' or 'Too low' to help the player guess the correct answer. Important Rules: 1. Make sure you use the function randrange in random module to make your game really randomize. No other random function is allows. 2. The output responses must follow exactly the above output list. Especially highlighted word should be used appropriately. 3. Failed to follow above rules might result the system not able to grade you correctly. 4. Program flow must follow the sample output. Sample Output: -quess the number game- your quess?100 "Too low. Try again your guess?500 Too low. Try again your guess?800 Too high. Try again your guess?600 Too low. Try again your guess?700 Too high. Try again your guess?650 Too low. Try again your guess?680 Too low. Try again your quess?690 Too low. Try again your guesa?699 Too high. Try again your gunn?695 Too high. Try again your on?693 Excellent! You guessed the number! would you like to play again(1-yon. 2-1o)? 1 your guess 2500 Too high. Try again your guess?250 Too low. Try again your guess?350 Too highs. Try again your guess?300 Too low. Try again your ques?350 Too high. Try again your s?340 Too high. Try again your gues7330 Too high. Try again your 7320 "Too low. Try again your guesa?325 Too high. Try again Your guesa?323 Tu low. Try again your quema324 Rollent You quested the number! would you like to play again (l-yon, o) 2 Thanks for playing the game

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

Recommended Textbook for

Database Concepts International Edition

Authors: David M. Kroenke

6th Edition International Edition

0133098222, 978-0133098228

More Books

Students also viewed these Databases questions

Question

When is it appropriate to use a root cause analysis

Answered: 1 week ago