[Tutor] Trouble executing an if statement with a string from an input
Timo
timomlists at gmail.com
Mon Apr 18 09:50:54 CEST 2011
On 18-04-11 05:11, Sylvia DeAguiar wrote:
>
> 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:")
>
Enter a debug print statement here to see what 'x' really is:
print repr(x)
Cheers,
Timo
> if x == "a":
>
> print ("a")
>
> elif x == "b":
>
> print ("b")
>
> else:
>
> print ('c')
>
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
More information about the Tutor
mailing list