<reponame>Sanjay9921/Python
low = 1
high = 1000

result = int(input("Enter a number between {} and {}, inclusive of both".format(low, high)))

guess = low
attempts = 1

while True:
    guess = low + (high - low) // 2
    if guess == result:
        print("The computer got it in {} attempts".format(attempts))
        break
    elif guess < result:
        print("Computer: Time to guess higher!")
        low = guess
    elif guess > result:
        print("Computer: Time to guess lower!")
        high = guess
    attempts += 1
low = 1
high = 1000

result = int(input("Enter a number between {} and {}, inclusive of both".format(low, high)))

guess = low
attempts = 1

while True:
    guess = low + (high - low) // 2
    if guess == result:
        print("The computer got it in {} attempts".format(attempts))
        break
    elif guess < result:
        print("Computer: Time to guess higher!")
        low = guess
    elif guess > result:
        print("Computer: Time to guess lower!")
        high = guess
    attempts += 1