Help: Review: functions - what is wrong with my code?


#1



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


When i click "save and submit" i get this error message:
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"

#2

yes and no are undefined variable, are you certain this should be variables?


#4

https://www.codecademy.com/en/forum_questions/503799a85c281900020032c1
i found this code :

def shut_down(reply):
     reply = reply.upper()
     if reply == "YES":
          msg = "Shutting down..."
     elif reply == "NO":
          msg = "Shutdown aborted!"
     else:
            msg = "Sorry, I didn't understand you."
     return msg

#5

see how yes and no are strings in this code? This important to see and understand


#6

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