nesting 'if' statements? solution...

erudite ask at me.com
Tue May 22 02:33:30 CEST 2001


Never mind I figured out my problem.... I didn't know python was so
sensitive to indentation and my program looked like this:

if expression:
    statements
        if expression:
            statements


It was balking at that because my second if statement was too far indented.

"erudite" <ask at me.com> wrote in message
news:%ShO6.1153$LT4.90852 at e420r-sjo2.usenetserver.com...
> Hey guys,
> Just a quick question:
>
> Is it possible to nest 'if' statements in python? If so how is it
> accomplished? Can you provide sample code?
>
> eg.
>
> if expression:
>     statements
>     if expression:
>         statements
>     elif expression:
>         statements
>     else:
> elif expression:
>     statements
>     if expression:
>         statements
> else:
>     statements
>
> --EOF--
>
> thanks,
> ~Eruditus~
>
> "You can't talk to a psycho like a normal human being." -- Poe 'Trigger
> Happy Jack'
>
>
>
>
>
>






More information about the Python-list mailing list