Ask your own question, for FREE!
MIT 6.189 A Gentle Introduction to Programming Using Python (OCW) 15 Online
OpenStudy (anonymous):

What is wrong with this code? #Write your two "if" statements below! x = 2 def true_function(): if x == 2: #Fill in your `if` statement here! return #Make sure this function returns `True` def false_function(): if x == 3: #Fill in your `if` statement here! return #Make sure this function returns `False` Make sure 'true_function()' is returning True! Oops, try again. I've tried all sorts of statements for True 3 == 3 etc but I still get the same comment.

OpenStudy (anonymous):

eh? did you put True after the word return in the function?

OpenStudy (anonymous):

Thanks Shadowys , it was looking me in the face, doh. It works now with True and False inserted.

OpenStudy (tyteen4a03):

A "return" with nothing to pass implies the result returned is None.

OpenStudy (anonymous):

you're welcome! :)

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!