版权声明:指剑 https://blog.csdn.net/fly1574/article/details/90403078
import random secret = random.randint(1,10) temp = input('不妨猜一下我现在心里想的数字:') guess = int(temp) while guess != secret: temp = input('猜错了,重新猜一下吧:') guess = int(temp) if guess == secret: print('我丢,你咋知道我想的是这呢?') else: if guess >secret: print('嘿,大了大了') else: print('又小了') print('Game Over,不玩了') 文章来源: https://blog.csdn.net/fly1574/article/details/90403078