The Big If = what is happening?


#1

I don't quite know wth is going on - can someone explain to me what I should do and what the program is actually doing???


I'm stuck here : https://www.codecademy.com/en/courses/python-beginner-BxUFN/4/1?curriculum_id=4f89dab3d788890003000096

and the console said this: Traceback (most recent call last):
_ File "python", line 10, in _
TypeError: theflying_circus() takes no arguments (1 given)_

So if someone would be so kind as to tell me how to interpret general errors that would be pretty awesome as it would make this process a lot easier :grin:
My code is below...


# Make sure that the_flying_circus() returns True
def the_flying_circus():
    x == input 
    if x >= 7:
        print "yessss"
    elif x <= 7:
        print "nooooo"
    else:
        print "mehhhhhhh"


#2

The above line is correct. Let's work down from there.

This is an incomplete statement from a practical standpoint. input is a function, in reality, but written this way it looks to Python like a variable, which is undefined and will raise an exception.

For Python 2 (which is what we are working with) use raw_input

x = int(raw_input("Enter a number: "))

Now the instructions are pretty specific about what our function should do...return True. Your code does not do this. Replace every print statement with,

return True

#3

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