Somebody please help with this piece of code, got stuck


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.


Which part are you stuck with, exactly? Do you have any code you have tried?


I'm stuck as well:

Make sure that the_flying_circus() returns True

def the_flying_circus():
if 3>2 and 2!=1: # Start coding here!
print "Now for somthing completely different!"
# the code inside this block!
elif try_something_different_you_twit():
print "You twit!"
# You'll want to add the else statement, too!
print "What were we talking about"

And I am getting the error:

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

What is a return statement? Did I miss it, or has it not been covered yet?


I, too, thought it was interesting that the return statement was not mentioned in the lesson but showed up in the review.

An image I found helpful showed the input going into the function, then the return providing the output. See Understanding Returns!

After each of your "print" statements, you need to add "return True" on the line below, then "return False" on the last segment.

I was totally lost, too. :slight_smile:


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