17. Review: Functions


#1



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"
    else:
        return "Sorry"


#2

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


#3

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


#4

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.


#5

thank you for explaining things bit by bit


#7

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


#8