# 3. Guess Bot # # By performing a binary search, Guess Bot can guess any value # between 1 and 1,000. If you don't enter one of the letters # L, H, or C after a guess, you will be prompted again. low = 0 high = 1001 count = 0 answer = '' while answer != 'C': middle = (low + high)//2 count += 1 print() print(f'My guess #{count} is {middle}') answer = '' while (answer != 'L') and (answer != 'H') and (answer != 'C'): answer = input('L, H, or C? ') if answer == 'L': low = middle else: high = middle