Python的猜数游戏

'''
功能:猜数游戏
作者:cxf
日期:2021年11月18日
'''
import random
while True:
    target = random.randint(0,100)
    x = int(input('Try to guess the number I am think of:'))

    while True:
     if x > target:
         x = int (input('Too higt! Guess again:'))
     elif x < target:
         x = int (input('Too low! Guess again:'))
     else:
         break
    choice = input('That is it! Would you like play again?(yes/no)')
    if choice == 'no':
        break

print('Thanks for playing.')

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_62590351/article/details/121405600