Question: The following program guesses the number that a user is thinking about. The following is a sample input/out from the program. Think of a number

 The following program guesses the number that a user is thinking

The following program guesses the number that a user is thinking about. The following is a sample input/out from the program. Think of a number from 1 to 100 Is your number greater than 50 Type YES or NO: YES Is your number greater than 75 Type YES or NO: NO Is your number greater than 63 Type YES or NO: YES Is your number greater than 69 Type YES or NO: YES Is your number greater than 72 Type YES or NO: YES Is your number greater than 74 Type YES or NO: NO Is your number greater than 73 Type YES or NO: YES Your number is: 74 There are two TypeErrors and two SyntaxError in the code. Fix them so that the code smoothly. Note: The user can only input YES or NO. Any other input will result in an assertion error. import time # Try debugging the following - a number guessing program # two TypeErrors and two syntaxError print("Think of a number from 1 to 100") time. sleep(1) min = 1 max = 100 whle max != min: i = (min + max) // 2 #INPUT MUST BE 'YES' OR 'NO' answer = input("Is your number greater than # Check the value is what we expect assert answer == "YES" or answer == "NO" + i + Type YES or NO: ") if answer = "YES": min = 1+1 else: max = i print("Your number is: + min)

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!