好学的单身狗 发表于 2018-6-28 13:05:32

新手做第一个python小游戏

print('-----------我爱鱼c工作室-----------')
tem = input("不妨猜一下我心里在想什么:")
guess = int(temp)
if guess == 8:
    print("厉害,这都猜到了。")
    print("哼,猜到了也没奖励。")
else:
    print("哈哈,猜出来,我心里想的是8.")
print("游戏结束")


-----------我爱鱼c工作室-----------
不妨猜一下我心里在想什么:9
Traceback (most recent call last):
File "D:\2345下载\python制作.py", line 3, in <module>
    guess = int(temp)
NameError: name 'temp' is not defined
>>>


为什么会这样,我看和小甲鱼做的视频一样啊。求指点。。。。。

BngThea 发表于 2018-6-28 13:11:40

第二行,temp 拼错,少个p

好学的单身狗 发表于 2018-6-28 13:17:15

BngThea 发表于 2018-6-28 13:11
第二行,temp 拼错,少个p

-----------我爱鱼c工作室-----------
不妨猜一下我心里在想什么:9
Traceback (most recent call last):
File "D:\2345下载\python制作.py", line 3, in <module>
    guess = int(tempp)
NameError: name 'tempp' is not defined
>>>
俩个p?

好学的单身狗 发表于 2018-6-28 13:26:19

BngThea 发表于 2018-6-28 13:11
第二行,temp 拼错,少个p

小甲鱼写的也是“temp”他的能用,我的不行。

BngThea 发表于 2018-6-28 14:13:54

好学的单身狗 发表于 2018-6-28 13:17
-----------我爱鱼c工作室-----------
不妨猜一下我心里在想什么:9
Traceback (most recent call last ...

不是,是前面那一句,
temp=input()

你写成了tem

好学的单身狗 发表于 2018-6-28 14:15:58

BngThea 发表于 2018-6-28 14:13
不是,是前面那一句,
temp=input()



哦哦哦!!!
多谢。
页: [1]
查看完整版本: 新手做第一个python小游戏