您需要 登录 才可以下载或查看,没有账号?立即注册
import random secret = random.randint(1,10) temp = input('请输入你猜测的数字:') guess = int(temp) cishu = 1 while (guess != secret) and (cishu < 3): if guess > secret: print('你猜错了,大了!') temp = input('请重新输入:') guess = int(temp) else: print('你猜错了,小了!') temp = input('请重新输入') guess = int(temp) cishu = cishu + 1 if (cishu < 3) or (guess == secret): print('恭喜你答对了!') else: print('你猜测的次数太多了,请下次再试!')
使用道具 举报
本版积分规则 发表回复 回帖后跳转到最后一页
小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)
GMT+8, 2024-12-23 05:48
Powered by Discuz! X3.4
© 2001-2023 Discuz! Team.