Review functions


#1

what did I do wrong
def shut_down(s):
if shut_down(s):
s = "yes"
return "Shutting down"
elif = no:
return "Shutdown aborted"
if shut_down
return "sorry"

Oops, try again. Your code looks a bit off. Feel free to peek back at earlier exercises if you need a refresher! Your code threw the following error: invalid syntax (python, line 5)


#2

Your mistake is that you are using the name of the fuction as the codition to evaluate in if/elif, when the actual variable is 's' , look here.

if s == "yes":
return "Shutting down"
elif s == "no":
return "Shutdown aborted"
else:
return "Sorry"

I hope you try to analize it before.


#3

this will work,,,,,
def shut_down(s):
if s == "yes":
return "Shutting down"
elif s == "no":
return "Shutdown aborted"
else:
return "Sorry"
don't forget to indent


#5

I tried this with proper indentation and it still doesn't work


#6

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