Nested if and expected an indent block
kagard@gmail.com
RentInGhent at gmail.com
Sun Aug 13 19:28:45 EDT 2006
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"
elif q.lower() == "no":
if "not" in c:
stmt_type = "A"
else:
stmt_type = "E"
else:
if "not" in c:
stmt_type = "E"
else:
stmt_type = "A"
return stmt_type
Any ideas? Thanks in advance.
Keith
More information about the Python-list
mailing list