def shut_down(s): return s if shut_down(yes): return("Shutting down!") elif shut_down(no): return("Aborting Shutdown") else: return("Sorry")
I'm supposed to create a code with the following instructions:
1) First, def a function, shut_down, that takes one argument s. Don't forget the parentheses or the colon!
2) Then, if the shut_down function receives an s equal to "yes", it should return "Shutting down"
However, I'm stuck after writing these few lines and trying a few different combinations.
Where should I fix? Thanks
You're really close, just need to tweak some things.
s is your argument and you want to see if
s is equal to yes, or no, or neither. So delete the
return s statement and put all of your if/elif/else statements inside your function.
I tried to erase the
but now it asks if I create a function called shut_down.
See you want to compare if
s if equal to yes, or no, or if it's not equal to any of those strings. If it is equal to yes, then you will return the string "Shutting down". If equal to no, then you will return the string "Shutdown aborted" Otherwise, return the string "Sorry". I wrote in the first part of the code I used to get you started. Now fill in for elif and else.
def shut_down(s): if s == "yes": return "Shutting down"
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.