17. function review


I tried to do it the same way you instructed and the error just changed

def shut_down(s):
    s = "No"
    if s == "yes":
        return "Shutting down"
    elif s == "No":
        return "Shutdown aborted"
        return "Sorry"

print shut_down

Oops, try again. Your function failed on the message yes. It returned 'Shutdown aborted' when it should have returned 'Shutting down'

Errors in 17.Review:Function


s = "No"

you overwrite your function paramater s, why?

"no" should also be all lowercase letters

finally, here:


print shut_down

why are this two lines? You call your function twice, but the second time without parentheses so this will give your function object as output


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