The Big If


#1



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"
    else:
        print "Try again"

#2

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..

the_flying_circus()


#3

Thank you! It worked.


#4

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