I am making a program that guesses a number that you are thinking of by telling the program if the number is higher or lower. I'm not getting errors, but I can't seem to update the variable "guess" in the while loop, it remains equal to 50. The formula for higher-lower is given by the textbook, so I can't change that.
I have tried moving the variable inside of the while loop, but still, it does not update.
print('Hello.')
print('Pick a secret number between 0 and 100.')
low = 0
high = 101
guess = 50
while True:
print('Is your secret number',guess)
use = input('Enter yes/higher/lower:\n').lower()
if use == 'yes':
print('Great!')
break
elif use == 'higher':
low = guess
guess = (guess-low)//2+low
elif use == 'lower':
high = guess
guess = (high-guess)//2+guess
else:
print('I did not understand.')