特别有趣的猜数小游戏

import random



while True:
    target=random.randint(1,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)")
    print()
    if choice =="no":
        break
    
print("That's it! Thanks for playing.")

特别有趣的猜数小游戏_第1张图片

你可能感兴趣的