[Tutor] if statement

James Reynolds eire1130 at gmail.com
Tue Nov 2 20:13:39 CET 2010


the syntax is:

if True:
     do something that you want to do if the condition you are testing is
True, in your case when confirmed is "y"
elif True:
     optional: do something else when the above condition is false and this
condition is True.
else:
     do something else when the above conditions are false.

You can try this,

if confirmed == "y":
    stuff
else:
    pass



On Tue, Nov 2, 2010 at 3:02 PM, Glen Clark <glenuk at gmail.com> wrote:

>  File "/home/glen/workspace/test.py", line 19
>    if confirmed == "y":
>                       ^
> SyntaxError: invalid syntax
>
> Why does this not work??? PyDev says "Expected:else"
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20101102/d548a137/attachment.html>


More information about the Tutor mailing list