[Tutor] Unknown reason for error.
christopher.henk at allisontransmission.com
christopher.henk at allisontransmission.com
Thu Sep 24 22:50:32 CEST 2009
> Hello, python tutors, its Corey.
Hi, Corey.
> candyNumber = raw_input("How many candies do you want? :"
You dropped a closing parenthesis in the line above. Having the syntax
error occur one line up from where it is indicated is not uncommon.
Another thing as long as we are here, in the code below.
> Anyway, I'm getting a syntax error for an unknown reason. Here is my
code...
> name = raw_input("What is your name?")
> print "Hello, ", name
> wellness = raw_input("How are you?")
> if wellness != "Good":
> if wellness != "Well":
> if wellness != "Fine":
> print "Oh, I'm sorry you are not feeling well. I guessed
correct, right?"
> else: print "Great!"
The else will only apply if they type in Fine
If you want it too apply to all three you would need to join the checks
together into one if statement with Boolean operators.
Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090924/cd0d30c3/attachment-0001.htm>
More information about the Tutor
mailing list