The Big If


The Big If

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

What is wrong with this code? Why doesn't it return "True"?

def the_flying_circus():
    if 8<5 and 2+2==4:
        print "False"
    elif 5>2:
        print "True"
        print "Try again"


Because you're not returning but printing.
one more thing "True"(surrounded by quotes, remember?) is a string , True tho is a boolean.

so use return statement.
alsoreturn True not return "True"

One more thing..
To use a function...After you define it..You need to call it..

add a new line of code calling this function..



Thank you! It worked.


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