Review: functions shut_down exercise syntax error


I’m struggling with the shut_down exercise in review: functions. If the shut_down function receives an s equal to “yes”, it should return “Shutting down”. Why am I getting a syntax error here? :thinking: Code is posted below the error message.

File “python”, line 2
if (s = “yes”)
SyntaxError: invalid syntax

def shut_down(s):
if (s = “yes”)
return “Shutting down” :
elif (s = “no”)
return “Shutdown aborted” :
return “Sorry”



Hi @cannonball_g,

It looks like you’re doing s = "yes" (which acts like assigning a value to a variable)
where you want to do s == "yes" (which checks if the variable s is equal to “yes”)

It’s a common mistake that takes practice to spot and overcome. Hope this helps! :smile:


Ahh, that makes total sense. Thanks for the enlightenment! :call_me_hand:


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