Reference no: EM132174933
Using Python:
Write a number guessing program. You should think of a number between 1 and 100. Then, over and over again, the computer can suggest an answer.
If that answer is too small, you enter the character >.
If the computer's answer is too large, you enter the character <. If the computer's answer is just right, you print "You win!" First write a program to play this game once, until the computer wins. After that is working, write a program that plays the game over and over, each time with a different number.
You can use the random number generator to generate the numbers.
Count the number of guesses for each game, and print the average number of guesses. There is a slow algorithm for finding the number, and a faster algorithm.
The slow algorithm is acceptable, but the fast algorithm is much better. Use the fastest algorithm you can think of.