[Tutor] if statement

Glen Clark glenuk at gmail.com
Tue Nov 2 20:17:53 CET 2010


I tried that and it still does not work. 

On Tue, 2010-11-02 at 15:13 -0400, James Reynolds wrote:
> 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
> 
> 




More information about the Tutor mailing list