Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use python Think of a number between 0 and 100. How could be make a computer aquess the number? The simplest method is to just

Use python

image text in transcribedimage text in transcribed

Think of a number between 0 and 100. How could be make a computer aquess the number? The simplest method is to just guess every value. This is a poor method. In real life, you would never use this solution. If someone had a number you were trying to guess, you would gain information with every failed guess In our guessing game, when the guess is incorrect the person with the secret number will say "higher" or "lower". This gives the other player information about where to guess next. (You can also play with "hotter" or "colder" but that algorithm is a bit harder.) Here is a basic layout of the higher/lower algorithm. Implement it in Python. Set three values low 0, high- 101, guess 50 While you have not guess correctly o Ask the user if it is correct, higher, or lower o If the secret number is lower than the guess set high-guess and your next guess is (guess-low)//2+low o If the secret number is higher than the guess set low-guess and your next guess is (high-guess)//2+guess If the input was not valid, say "I did not understand." and make the same guess again. Your output should match the below example Hello. Pick a secret number between 0 and 100 Is your secret number 50 Enter yes/higher/lower: Lower Next is 25 Is your secret number 25 Enter yes/higher/lower higher Next is 37 Is your secret number 37

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

XML Data Management Native XML And XML Enabled Database Systems

Authors: Akmal Chaudhri, Awais Rashid, Roberto Zicari, John Fuller

1st Edition

0201844524, 978-0201844528

More Books

Students also viewed these Databases questions

Question

=+Are they specific or general in nature?

Answered: 1 week ago

Question

=+ What is the nature of the contracts or agreements with unions?

Answered: 1 week ago

Question

=+What is the procedure for labor relations in the workplace?

Answered: 1 week ago