特别有趣的猜数小游戏

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.")

在这里插入图片描述

Guess you like

Origin blog.csdn.net/m0_62491934/article/details/121406164