鱼C论坛

 找回密码
 立即注册
查看: 3476|回复: 0

[学习笔记] 学习第四课了 记录一下 有错误地方 望指点

[复制链接]
发表于 2020-2-12 21:29:19 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
  1. import random
  2. secret = random.randint(1,10)
  3. temp = input('请输入你猜测的数字:')
  4. guess = int(temp)
  5. cishu = 1
  6. while (guess != secret) and (cishu < 3):
  7.     if guess > secret:
  8.         print('你猜错了,大了!')
  9.         temp = input('请重新输入:')
  10.         guess = int(temp)
  11.     else:
  12.         print('你猜错了,小了!')
  13.         temp = input('请重新输入')
  14.         guess = int(temp)
  15.     cishu = cishu + 1
  16. if (cishu < 3) or (guess == secret):
  17.     print('恭喜你答对了!')
  18. else:
  19.     print('你猜测的次数太多了,请下次再试!')

复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-4-22 17:49

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表