vendredi 28 juillet 2017

Why does this "if string" conditional always give me true?

I have the next problem (oversimplified) on this python code:

a = raw_input("Write l or r:\n")
if a == 'l':
    print "you press l"
elif a == 'r':
    print "you press r"

So it give me always "you press l". I also tried str(input) but same and:

a = raw_input("Write l or r:\n")
if a == 'l':
    print "you press l"
else:
    print "you press r"

And same. What should i do?

Aucun commentaire:

Enregistrer un commentaire