我收到以下错误消息:
Traceback (most recent call last):
File "/Volumes/KINGSTON/Programming/Assignment.py", line 17, in <module>
Assignment()
File "/Volumes/KINGSTON/Programming/Assignment.py", line 3, in Assignment
我的代码是:
在
^{pr2}$
如果有人知道我的错误并能解释,我将非常感谢你的帮助
Tags:
引发这个特定的错误是因为当您说
result = PIN
,PIN
实际上并不存在。因为它不在引号中,所以Python假设它是一个变量名,但是当它去检查这个变量是什么时,它找不到任何东西,并引发NameError
。当您修复这个问题时,prompt
也会发生这种情况,因为您稍后将其称为Prompt
。在我不确定这是否是您的完整代码,所以我不确定其他问题可能是什么,但看起来您似乎正在使用}来控制
result
和{while
循环。请记住,while
循环会一直运行,直到它所检查的条件是False
(或者如果您手动打破它),那么您可以从以下内容开始,而不是声明额外的变量:相关问题 更多 >
编程相关推荐