Question: 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

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

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!