The Big IF: Returning None


I think I am mising something fundamental with my code. This is the first time I'm learning any kind of coding so I'm susceptible to simple errors.. I'm currently getting the error "Oops, try again. the_flying_circus() returned the value None, did you forget to add a return statement?"

The goal is to print True. What am I doing wrong here?

# Make sure that the_flying_circus() returns True
def the_flying_circus():
    if 5>9:    
        print "False" 
    elif 5<9 and 1+2==3:
        print "True" 
        print "Done messed up"

print the_flying_circus


You need to return BOOLEAN values. You are currently printing STRING values.
Goal is to make the_flying_circus() return True. It says in the comment on the first line of your code.


The only time you will print is at the end of the entire function, which you've already have.

As @datfatcat said, You want to 'return' instead of print. Take a closer look at the instructions and look carefully at their wording. It's easy to have it go over your head. It happens to all of us when starting.


there is a difference between True and "True". check that but take heart you were not far off


done messed up does not work. change it to:
return True
The reason you need to do this is because "print" shows the result, but "return" also allows the computer to use the data later on. You may not have learn this yet, but the_flying_circus is a FUNCTION. Therefore you might want to STORE the result of the function for later.
I hope this helps.


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