"y" or "yes" -- expectations not met
<p>In the following code, <code>answer()</code> works as expected and returns true if input is "y" and false when not, but in <code>answer2()</code>, it always returns true.</p>

<p>Can someone explain why this is the case?</p>

<pre><code>def answer():
    answer = raw_input()
    if answer == "y":
        return True
    else:
        return False


def answer2():
    answer = raw_input()
    if answer == "y" or "yes":  # &lt;- notice the extra: or "yes"
        return True
    else:
        return False


if answer() == True:
    print "true"
else:
    print "false"


if answer2() == True:
    print "true"
else:
    print "false"
</code></pre>
