鱼C论坛

 找回密码
 立即注册
查看: 5818|回复: 7

[已解决]新手小白求大神看看我的这个作业的问题谢谢啦

[复制链接]
发表于 2017-4-27 21:42:04 | 显示全部楼层 |阅读模式

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

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

x
print("~~~~~~~~~~game~~~~~~~~~")
temp = input("猜一猜我心里的数字:")
guess = int(temp)
while gusee!=8:
    temp = input("诶呀猜错了,请从新输入吧:")
    guess = int(temp)
    if guess == 8:
        print("你猜对了")
    else:
        if guess > 8:
           print("大了,大了")
        else:
           print("小了小了")
print("game over")                 
最佳答案
2017-4-27 22:02:23
本帖最后由 太阳花田 于 2017-4-27 22:11 编辑

我看错了 sorry  NameError: name 'gusee' is not defined  你的while那里写成了gusee  原为guess
你把这句英文一翻译就知道了  要学会看异常调debug
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2017-4-27 21:47:21 | 显示全部楼层
while里面改成guess = int(input())   你这样guess永远是 原始值  无限循环了
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2017-4-27 21:50:34 | 显示全部楼层
没看出问题来。。。。。。。。
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2017-4-27 21:55:21 | 显示全部楼层
试了试  没问题啊
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2017-4-27 22:02:23 | 显示全部楼层    本楼为最佳答案   
本帖最后由 太阳花田 于 2017-4-27 22:11 编辑

我看错了 sorry  NameError: name 'gusee' is not defined  你的while那里写成了gusee  原为guess
你把这句英文一翻译就知道了  要学会看异常调debug
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2017-4-27 22:08:04 | 显示全部楼层
Python 3.5.1 (v3.5.1:37a07cee5969, Dec  6 2015, 01:38:48) [MSC v.1900 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>>
=========================== RESTART: C:\学习\2.0.py ===========================
~~~~~~~~~~game~~~~~~~~~
猜一猜我心里的数字:8
Traceback (most recent call last):
  File "C:\学习\2.0.py", line 4, in <module>
    while gusee!=8:
NameError: name 'gusee' is not defined
>>>
用的时候就是显示的这个
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2017-4-27 22:09:55 | 显示全部楼层
瑜阳 发表于 2017-4-27 22:08
Python 3.5.1 (v3.5.1:37a07cee5969, Dec  6 2015, 01:38:48) [MSC v.1900 32 bit (Intel)] on win32
Type ...

NameError: name 'gusee' is not defined 名字异常:gusee没有定义   看上面楼
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2017-4-27 22:11:01 | 显示全部楼层
谢谢亲
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-7-23 00:06

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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