The Big If - What's wrong with my code?


Write an if statement in the_flying_circus(). It must include:

if, elif, and else statements;
At least one of and, or, or not;
A comparator (==, !=, <, <=, >, or >=);
Finally, the_flying_circus() must return True when evaluated.
Don't forget to include a : after your if statements!

My Code:

def the_flying_circus():
if 4 < 5:
print True
elif 6 < 5:
print False
print True
print the_flying_circus():


Does your code comply with the instructions? You do not use any and, or, or not statements.


At first do what @alan-redding told you
also remember you don't need : to call a function

print the_flying_circus(): # remove :


I updated my code to the following:

if 4 < 5 and 3 == 3:
print True
elif 6 < 5 or 4 > 5:
print False
print True
print the_flying_circus()

I'm getting the following error message:

Oops, try again. the_flying_circus() returned the value None, did you forget to add a return statement?

What did I do wrong?


In order for it to return anything you need to have a return statement instead of your print statements.


Thank you Alan-redding

I updated to the following and it worked!

ef the_flying_circus():
if 4 < 5 and 3 == 3:
return True
elif 6 < 5 or 4 > 5:
return False
return True
print the_flying_circus()

Thanks for your help!


No problem! I'm glad you were able to work through it. Enjoy the lessons!


I did enjoy the lessons!

Now that I'm finished, it's giving me 2 options for my next course. Which do you suggest I take next?

Functions or the Pyth Language


Whichever one is numerically next. Just try to do them all so you can learn as much as possible.


For the Big if question it states that "Finally, the_flying_circus() must return True when evaluated." So am guessing the equation for that is True and False or not True, because If what i said is not mistaken then it comes out to be false.
Not true = False
True and False = False
False or False = False this being the final answer.

Correct me if am wrong plz, am kinda struggling on this one.


You are correct, that comes out to false. If you want to test code outside of the codecademy environment and are unable to set an environment up on your own machine, you can use other online environments to test quick theories about code. Here is one that I use from time to time:

Also, it is bad practice to tack on to other peoples questions. Feel free to start your own thread, there are a number of really good people on here who are more than willing to answer any questions.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.