17.review:functions


#1



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


i am getting the error:
Oops, try again. Did you create a function called shut_down?


this was the question:
First, def a function, shut_down, that takes one argument s. Don't forget the parentheses or the colon!
Then, if the shut_down function receives an s equal to "yes", it should return "Shutting down"
Alternatively, elif s is equal to "no", then the function should return "Shutdown aborted".
Finally, if shut_down gets anything other than those inputs, the function should return "Sorry"


the code is:
def shut_down(s):
    if yes:
        return "Shutting down"
    elif no:
        return "Shutdown aborted"
    else:
        return "Sorry"


#2

here:

if yes:

yes is a undefined variable. Which will throw an error


#3

So that's the problem then - codeacademy neglected to instruct us to define the variable "yes" - it might be helpful to fully answer the question with an example, since your instructions are incomplete.


#4

no? yes never should have been a variable, why would you make it a variable? What other data types do we have and could we use here?


#6

I don't get it at all


#7

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