猜数游戏循环版

'''
功能:猜数游戏
作者:
日期:
'''
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.')

猜数游戏循环版_第1张图片

你可能感兴趣的:(python,开发语言,后端)