On 01/02/2015 12:09, sathya kumar Prasanna wrote:
Hi guys,

I am completely new to programming and have never had the opportunity to do
attempt coding before. However I have started now and am facing my first
problem.
The code is as shown, I need to *fill in the blanks* such that when the
code is run it gives the answer as "True".

#Please help.

# Make sure that the_flying_circus() returns True
def the_flying_circus():
     if ________:    # Start coding here!
         # Don't forget to indent
         # the code inside this block!
     elif ________:
         # Keep going here.
         # You'll want to add the else statement, too!

Thanks and Regards
Mr. Sathyakumar Sharma,

That's easy, simply add "Return True" as the last line of your function. However I suspect that you haven't asked the correct question. Did you actually mean "How do I test that the call to the_flying_circus returns True?"? If I'm correct in Python you normally check for "truthiness" as opposed to the actual values "True" and "False". Hence:-

if the_flying_circus():
    doThis()
else:
    doThat()

--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to