[Tutor] Trouble executing an if statement with a string from an input

Sylvia DeAguiar mebesylvie at yahoo.com
Mon Apr 18 05:11:52 CEST 2011


The code runs fine on python shell (from run module) but
when I try to execute the program from its file, it always prints out c, regardless
of the input. What is wrong? Thanks for any help :)

 

x = input("a, b, or c:")

if x == "a":

    print
("a")

elif x == "b":

    print
("b")

else:

    print ('c')

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110417/6be743d3/attachment.html>


More information about the Tutor mailing list