Nested if and expected an indent block

Tim Williams tim at tdw.net
Sun Aug 13 19:36:16 EDT 2006


On 13 Aug 2006 16:28:45 -0700, kagard at gmail.com <RentInGhent at gmail.com> wrote:
> Greetings:
>
> I'm brand new to Python and decided to write a syllogism solver for a
> class I'm taking. At the start of the program, I define a function that
> classifies the type of each statement in the syllogism. Python tells me
> that it is expecting an indented block at the s in "some". I can see
> what I'm doing wrong. Here's the code:
>
> def class_stmt(q,c):
> """
> This function classifies a statement according to the rules of
> categorical syllogisms and returns A, E, I, O to identify the
> statement type.
> """
>     if q.lower() == "all":
>         if "not" in c:
>             stmt_type = "E"
>         else:
>             stmt_type = "A"
>     elif q.lower() == "some"    # s in some is highlighted
>         if "not" in c:
>             stmt_type = "O"
>         else:
>             stmt_type = "I"

It might be the missing colon after "some"

If that's a typo on your email rather than in your script you should
post the full traceback of the error.

HTH :)



More information about the Python-list mailing list