15 The Big If


#1

Guys I keep getting an error with the following code

# Make sure that the_flying_circus() returns True
def the_flying_circus():
    if (1==2):    # Start coding here!
        # Don't forget to indent`indent preformatted text by 4 spaces`
        # the code inside this block!
    elif (False):
        print 'nothing'
        # Keep going here.
        # You'll want to add the else statement, too!
    else:
        return True

The error is...

  File "python", line 6
    elif (False):
       ^
IndentationError: expected an indented block

I'm looking at line 6 but don't see my indentation as being off.
What am I missing here?


#2

I don't know about the indentation, but your if/elif/else parameters should not be in parantheses. They should look like this:

if 1==2:
#insert code
elif False:
#insert code
else:
#insert code


#3

Unfortunately that doesn't to fix it. I originally had it without the parenthesis and put them in later to see if it'll fix it. This what i currently have while still getting the same error.

# Make sure that the_flying_circus() returns True
def the_flying_circus():
        if 1==2:    # Start coding here!
        # Don't forget to indent
        # the code inside this block!
        elif 3==1:
        # Keep going here.
        # You'll want to add the else statement, too!
        else:
            return True

I starting to think this might just be a glitch in the lesson...maybe this is the end of my python learning


#4

Ok I found a solution.
I erased everything that was pre written and wrote everything from scratch and it went through.
SUCCESS!


#5

It Won't Work :sob: :rage:


#6

The Instructions say after the if statement put : I tryed and it will not work!


#9

Just add:
return True
to every block with if, elif and else.


#10

def the_flying_circus():

if 8 >= 8 and "A" == "A" : # Start coding here!
    return True # Don't forget to indent
    print "Ok"# the code inside this block!
elif 3 < 8 :
    return False # Keep going here.
    print "Opps" # You'll want to add the else statement, too!
else:
    print "Smth"``

#11

doesn't work you may want to retry it again as it will not work


#12