[Tutor] invalid syntax (reply)

Brett Wilkins lupin at orcon.net.nz
Thu Sep 24 23:57:04 CEST 2009


if wellness != "Good":
   elif wellness != "Well":
       elif wellness != "Fine":
           print "Oh, I'm sorry you are not feeling well. I guessed  
correct, right?"

I think the problem is the elif's and the indents...
elif is 'else if', and should be at the same indentation level as the  
previous if statement that it is providing the else cause for.
In this case, it looks like you're just checking that wellness is not  
one of those words....
I would use:
if wellness not in ["Good","Well","Fine"]:
	print "Oh, I'm sorry you are not feeling well. I guessed correct,  
right?"

See in that works out for you.
Also, if you're using python3, the print statement will need brackets  
(like a function).

Cheers
--Brett

On 25/09/2009, at 9:43 AM, Corey Richardson wrote:

> if wellness != "Good":
>   elif wellness != "Well":
>       elif wellness != "Fine":
>           print "Oh, I'm sorry you are not feeling well. I guessed  
> correct, right?"

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090925/f6987dcb/attachment.htm>


More information about the Tutor mailing list