17. Review: Functions


I keep getting this error message:

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

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


Use string expressions to compare inputs. "yes" and "no"


I have the same problem but i don't know what do you mean by use string expressions to compare inputs


The above code uses yes which looks like an identifier to the interpreter. Since the variable is undefined it will raise an exception.

if input == yes     # wrong

if input == "yes"   # right

"yes" is a string expression.


thank you for explaining things bit by bit


3 posts were split to a new topic: Why does this not work?