python if statement always false
Question: I am having issues with an if statement always returning false. I am writing
my code in Canopy. I am almost positive it's my syntax, because I replaced "is
'graj mahal'" with "> 200", input a value of 300 and it returned "sounds
great!". Here is the excerpt of my code in question:

    
    
    answer = str(raw_input("What do you want for dinner?"))
    if answer is "graj mahal":
        print ("Sounds great!")
    else: 
        print ("Ewie")
    print ("the end")
    

Any suggestions? Thanks for your help.


Answer: The reason OP's code was not working was that he was checking for the identity
of two equal strings, which, even if equal, are not considered the same
object.

In some conditions, the interpreter may cache string values (this is called
string "interning"), but not always, and only for short strings.

It's very important to properly differentiate the concepts of identity and
equality in Python. Identical objects sit at the same address in memory. Equal
objects are considered so by the return value of `__eq__`.

