The Big If


#1

def the_flying_circus():
if (5>2) and (3<8) :
return True
elif not 5<3:
return False
else:
return True

I don’t understand what I am doing wrong. Can someone help me please?


#2

@johnnycena3,
What is the Oops- or Error-message you are receving…

Write an if statement in the_flying_circus(). It must include:
ok. 01. if, elif, and else statements;
ok. 02. At least one of and, or, or not;
ok. 03. A comparator (==, !=, <, <=, >, or >=);
ok. 04. Finally, the_flying_circus() must return True when evaluated.

Don’t forget to include a : after your if statements!

Please re-edit your Post

  • leave one blank-line above of your code
  • select your code in the Post
  • then =click= on the </>-symbol-of-this-editor

Your code will then be in a pre-code state
and you will be able to make/present the proper indentations.

or even better use
= How do I format code in my posts?
[extra’s]
https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet


#3
def the_flying_circus():
    if 2>1 and 3>=2 or True:    # Start coding here!
        # Don't forget to indent
        # the code inside this block!
        print "True"
        return True 
        elif  not True and 3==3 or 3!=4 or 3<=3:
        # Keep going here.
        # You'll want to add the else statement, too!
        print "False"
        return True 
        else:
            print True 
            return True 
           
            the_flying_circus()

can someone edit this code. I get an error saying " An exception was raised while running your code, see the console window for the error message."


#4

You need to indent:

def the_flying_circus():
    if 2>1 and 3>=2 or True:    # Start coding here!
        # Don't forget to indent
        # the code inside this block!
        print "True"
        return True 
    elif  not True and 3==3 or 3!=4 or 3<=3:
        # Keep going here.
        # You'll want to add the else statement, too!
        print "False"
        return True 
    else:
        print True 
        return True 
           
the_flying_circus()