The Big If -Lesson 15


I don't understand this exercise. I had to return a a function as true but I never defined it? I was not allowed to create arguments. How do I define when it is true or false then? How does the program check my if statements if the function is undefined? What am I supposed to learn in this instance?

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!

I forced a correct answer with this but I feel this was more of a result of hacking the answer then any comprehension.

Make sure that the_flying_circus() returns True

def the_flying_circus():
if True or False:
return True
elif X>5:
return True

    return False

Are there model answers anywhere?


Just write any conditional statements that satisfy the requirements they gave you and make sure that the function evaluates to True in the end. I don't think there's any "hack" to this question as you can basically write any conditional statements. It doesn't matter if there are no arguments, it's just saying that you don't need any input. The function is defined as long as you have a name for it and that it can output something. It doesn't always have to have an input (parameter/argument).
Yours is completely fine!

Here's mine:

def the_flying_circus():
    if 5 == 5:
        return True
    elif (6 == 6) or (6 < 5):
        return False
        return 0


The function is partially written and you add the conditions so that the function evaluates to True. That's all that has been specified in terms of the result. So you have to include the various conditionals & control flow to that end. Think about whether or not the function would continue from the initial 'if' when it evaluates to False. Would it return False and consider the function to have been executed or would it move on to elif?


Hey! Thanks a lot man.
I too was stuck on this section, was kinda confused by what they were asking me to do.
But, your answer cleared up everything for me.

Appreciate it :slight_smile:


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