The big if: syntaxerror with booleans


#1

here is my code. console says:

File "python", line 5
    else 3 > 7 and 45 < 74:
         ^
SyntaxError: invalid syntax

def the_flying_circus():
    if 23 * 3 == 11:   
        print False
    else 3 > 7 and 45 < 74:
        print False
    elif 2 ** 3 == 8:
        return True

what am i doing wrong?


#2

Hi @superkids,

You must use elif before else. Moreover, you do not put conditions with else clauses. I'll suggest you to take a refresher of the previous if-else exercises to be careful about these errors.

P.S. Code formatting guide.


#3

thank you @gaurangtandon ! this solved my problem.