Why is this wrong? (Python)


#1

I don’t really understand why this was given wrong during a lesson in python on codecademy. Codecademy said that my code returned Shutting Down when “no” was selected, which was wrong.

Here are the instructions:

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”

This was my response:

def shut_down(s):
if “yes”:
return "Shutting down"
elif “no”:
return "Shutdown aborted"
else:
return "Sorry"
If you know the answer, please reply as I am very confused about this problem.


#2

if “yes” and elif “no” need to be if s == “yes” and elif s == “no” it needs to know what its comparing to “yes” and “no”


#3

Oh. ok thanks for that


#5