If statement error when I declare strings in if statements it shows error

a = raw_input(“check whether they are married”)
if married:
print(“congrats”)
else:
print(“when will you get married”)

What are you trying to do here?

And what is raw_input?

edit: python 2.7 uses raw_input()

Why are you mixing V2.7 and V3.6 code?

If you don’t know the basics, you can learn from here…

Please don’t show screenshots or images of errors. Copy and paste the text of the exception, starting from the Traceback line.

The secret to debugging is to always start by reading the error message carefully. What does the error message tell you?

Your error is:

NameError: name 'married' is not defined

and that tells you that the variable married is not defined.

Now look at your code: where have you defined the variable married?

(Answer: you haven’t defined it anyway. How can the interpreter check the value of married if it doesn’t have a value yet?)

By the way, why are you still using Python 2? It is old and obsolete and no longer supported. Python 3 is much, much better.