17. Review:Function


#1

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

Oops, try again. Did you create a function called shut_down?

def shut_down(s):
    if s == yes():
        return "shutting down"
    elif s == no():
        return "shutdown aborted"
    else:
        return "sorry"

I am unsure why I am getting the above error, surely def shut_down(s): is the function in question?


#2

i would look at the error message in the output window, is there one? If not, add a function call at the end:

print shut_down("no")

now you can the interpreter error message in output window which is much more useful


#3

Here are the errors I get when I add that:

Traceback (most recent call last):
File "python", line 9, in
File "python", line 2, in shut_down
TypeError: 'str' object is not callable

Line 9 is the new function call and line 2 is if s == "yes"():


#4

why the () after "yes"? This means python is going to attempt a function call on a string, that won't work (str(ing) object not callable, as you can see in the error message)


#5

Not sure why I did that but it was the only problem I had so thanks for the help.


#6