What am I doing wrong?


#1

What am I doing wrong, I don't understand it. Anyone can help please?

Make sure that the_flying_circus() returns True

def the_flying_circus():
if 5 > 4:
print "The Flying Circus is waiting for you"
return "True"

elif (5 < 4) and (5 <= 4):
    print "The Flying Circus is leaving without you"
    return "False"

else:  
    return "True"

I get this message:

Oops, try again.
the_flying_circus() should return True, instead it returned: 'True'


#2

True shouldn't be in " " here,

False shouldn't be in " " here,

And lastly also here,

Remove all the quotation marks " "


#3

@giorgio_f Functions don't work like that. Functions will always have one return statement, also, "if,elif, and else" statements do not require return statements. Another thought, is the when you are returning true:

You do not do it like that. True is a boolean which means it doesn't need quotes, giving it quotes makes it a string. To make your code right, you need to delete all of the return statements under the if statements, and put a print statement for the "else" part of you function. Then, you have to make sure the function "returns True" as that is what the instructions ask of us. If you follow all the instructions I have given you, then your code with look like this:

def the_flying_circus():
    if 5 > 4:
        print "The Flying Circus is waiting for you"
    elif (5 < 4) and (5 <= 4):
        print "The Flying Circus is leaving without you"
    else:  
        print "Whatever you want to print here"
    return True

Let me know if you need more help after that. Good luck and happy coding! :slight_smile:

-- @chipjumper36731


#4

Thank you for your help. The main problem was the quotes, when I deleted them everything worked fine.

@chipjumper36731 Thank you for the guidance and all the details !


#5

@giorgio_f Glad to help! Keep coding! :slight_smile:


#6

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