Python Forum
inserting input gives me error message - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: inserting input gives me error message (/thread-15385.html)



inserting input gives me error message - RubberNuggets - Jan-15-2019

I keep getting this error message
Error:
Traceback (most recent call last): File "U:/Computer Programming/Python/Quiz how.py", line 3, in <module> if (answer_1 == Flat): NameError: name 'Flat' is not defined
My Code is
score = 0
answer_1 = input("What is the shape of the Earth?")
if (answer_1 == Flat):
    print("You got it right")
    score = score + 1
    print("Your Score is:", score)
else:
    print("You are incorrect, The answer was Flat")
    print("Your Score is:", score)
please help me


RE: inserting input gives me error message - buran - Jan-15-2019

please, read https://python-forum.io/Thread-Python3-2-differences-input-vs-raw-input

I overlooked the traceback. See the answer in next post


RE: inserting input gives me error message - Axel_Erfurt - Jan-15-2019

quotation marks are missing

if (answer_1 == "Flat"):



RE: inserting input gives me error message - buran - Jan-15-2019

Oh, I overlooked that.