Review : Functions code error


invalid syntax (python, line 2)

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


You should compare in an if condition, ===.


I don't get it :frowning: What do you mean by : "You should compare in an if condition"


You are trying to compare s to the string "yes", correct? You can't use one equal sign to do that, because one equal sign means you're setting it to something. You need to use two equal signs to compare, so it would look like

if s == "yes":


I remember trying it with double "=" but it still got an error, this time it worked, I guess I forgot the >""< when writing the two equal sign code. Ty for help


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