<> introduce

If I give you a given range , Let you guess any number in this range , How can you guess you quickly and accurately ? Available
dichotomy , For example, guess within one to onehundred , Guess fifty first , If you are old, guess 25 , If it's small, guess 75 , If you go on like this, you'll soon guess the number !

<> program
import random target = random.randint(0,100) x = int(input("Try to guess the
number I'm think of:")) while True: if x > target: x = int(input('Too high!
Guess again:')) elif x < target: x = int(input('Too low! Guess again')) else:
break print("That's it! Thank for playing!")
<> See the program results

This program ends in one go , But if users want to play the program several times, how can they improve it ?

<> Improvement procedure
import random while True: target = random.randint(0,100) x = int(input("Try to
guess the number I'm think of:")) while True: if x > target: x = int(input('Too
high! Guess again:')) elif x < target: x = int(input('Too low! Guess again:'))
else: break choice = input("That's it! Would you like to play again?(yes/no)")
if choice == 'no': break print("That's it! Thank for playing!")
<> See the program results

So users can play many times !

Technology