代码中的NameError,未定义'mars'

时间:2016-10-31 00:53:23

标签: python-3.x

第1行我收到错误,不知道问题是什么

Traceback (most recent call last):
  File "python", line 1, in <module>
  File "<string>", line 1, in <module>
NameError: name 'mars' is not defined

以下是代码:

x = int(input("what is the fourth planet in the solar system: "))
if x == mars:
    print ("correct")
else print ("incorrect")

1 个答案:

答案 0 :(得分:-1)

您忘记了火星周围的引号,就像这个ADD

一样