Stuck On 'The Big If'!


#1



https://www.codecademy.com/en/courses/python-beginner-BxUFN/4/1?curriculum_id=4f89dab3d788890003000096


Hullo hullo! I've been trying to understand what's wrong with my code for a while now, but I can't seem to get it.
This is my code:


def the_flying_circus():
    if the_flying_circus() > 70 and the_flying_circus != 70:
        return True
    elif the_flying_circus() == 68 and the_flying_circus != 67:
        return True
    else:
        return False
        the_flying_circus()
the_flying_circus(71)


This is my error message:

Help please!


#2

well first off, you probably want the_flying_circus() in these cases

Secondly, this the_flying_circus is not necessary as far as I can tell.

Thirdly, when call the the_flying_circus(); function you just call it without a parameter in it.


#3

Thank you for replying!

When I called the_flying_circus without a parameter, I got this:

I did what you said, so this is how the code looks now:

def the_flying_circus():
    if the_flying_circus() > 70 and the_flying_circus() != 70:
        return True
    elif the_flying_circus() == 68 and the_flying_circus() != 67:
        return True
    else:
        return False
    
the_flying_circus(71)

But I still got the same error message as before.


#4

Yeah I got that same error when I tried to do all the_flying_circus() in my if and elif statements. When I had the if statement with numbers and the elif statement with the_flying_circus it passed. I am not sure exactly why this is however. I will try and do some research on it.


#5

So recursion as best as I can tell is when you are calling the function itself from within the function. Now, most of the time this is a bad thing. However, here, in a limited capacity, it does work. I would recommend using numbers only for this lesson but unless we are told otherwise, we can stick if yours.

Also, I just noticed this:

Your still calling the_flying_circus with a parameter of 71? Get rid of it! :smiley:


#6

:tired_face:

Please tell me what's wrong here (i am a dense mofo)


#7

@sashaglot notice my earlier reply. Maybe, you should just set up numerical equations instead. Might save you some headaches. For example: if 10 - 5 == 5 and 2 + 2 = 4 return True.


#8

Thank you! Everything worked out.
Btw, is your username a reference to David Mitchell?
Either way, have a good day!


#9

Good glad to have helped! And no... I have never heard of him haha Its a reference to an old tv show I watched as a kid religiously by the same name :smiley: And yes have a great day! :thumbsup:


#10

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