Question: In Python (4) (20) In a typical high-low number guessing game, the computer generates a random number, and we (humans) input the guess until a

(4) (20) In a typical "high-low" number guessing game, the computer generates a random number, and we (humans) input the guess until a correct one is detected. Write a program where these roles are reversed: the user (human) thinks of a number X for the computer to guess. Then, similar to the human guessing version, the user must provide "> " to indicate smaller and higher for the computer to adjust the next guessing. Finally, the user enters "= " when the computer guess is correct. The user must initially input the number range(lower and upper) bounds. The 'secrete' number must be anywhere within the bounds. Next, the computer must complete the maximum number of guesses needed based on the equation: round (log2( high low +1). Your program needs to track the number of guesses. If the number of guesses is larger than the maximum, display the message "you are cheating!" (as you, the user change the initial number X during guessing) For the following example: ( my initial number was 20) Enter the smaller number: 1 Enter the larger number: 120 Your number is 60 Enter =,:::> Your number is 22 Enter =,::> Your number is 20 Enter =,:= Hooray, I've got it in 6 tries! For this example, the secret number is 75 . After the guess of 60 , I was "misled" about the direction. Enter the smaller number: 10 Enter the larger number: 110 Your number is 60 Enter =,::> Your number is 47 Enter =,:> Your number is 53 Enter =, : > Your number is 56 Enter =,, or >:> Your number is 58 Enter =,:> Your number is 59 Enter =, : You're cheating! Process finished with exit code 0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
