name error not defined in python [duplicate]

不问归期 提交于 2019-12-11 16:54:52

问题


So this is the basic string (the text is in hungarian before you are wondering):

>>> nev=input("add meg a neved: ")
add meg a neved: Kristóf
>>> print("Üdvözöllek, " + nev)
Üdvözöllek, Kristóf
>>> print("egy út előtt állsz")
egy út előtt állsz
>>> print("elindulsz rajta")
elindulsz rajta
>>> arany: 0
>>> print("Most" + str(arany)+ "aranyad van")
Traceback (most recent call last):
  File "<pyshell#5>", line 1, in <module>
    print("Most" + str(arany)+ "aranyad van")
NameError: name 'arany' is not defined

The error message claims that the name is not defined, even though I gave it a value in the IDE, and I just cannot figure out what exactly did i wrote wrong...

any help would be greatly appreciated


回答1:


It should be arany = 0, not arany: 0 - I'm not sure why that's even valid.



来源:https://stackoverflow.com/questions/48336724/name-error-not-defined-in-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!