I am trying to make a guessing game in python using bisection search. my code goes like this.
print('please think of a number between 1 and 100')
high=100
low=1
guess=int((high+low)/2)
n=input('is your number 50? press y to yes, l to low, h to high ')
while n!='y':
if n=='h':
high=guess
n=input('is your number '+str(guess)+'? press y to yes, l to low, h to high ')
elif n=='l':
low=guess
n=input('is your number '+str(guess)+'? press y to yes, l to low, h to high ')
print()
else:
n=input('wrong input. press y to yes, l to low, h to high ')
print()
guess=int((high+low)/2)
print('game over. i guessed correctly')
But unfortunately, I dont get desired things out of this code. Would you mind to help me? Thanks in advance