Review Functions indent issues!



<Below this line, add a link to the EXACT exercise that you are stuck at.>

<In what way does your code behave incorrectly? Include ALL error messages.>
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: unexpected indent (python, line 3)

<What do you expect to happen instead?>
I dont understand why its giving me an error on indentation, I used tabs for spaces but still get the same error


Replace this line with your code.
def shut_down(s):
if s: "yes"
return "Shutting down"
elif s: "no"
return "Shutdown aborted"
return “Sorry”

<do not remove the three backticks above>


Let’s take a look at some of your code:

So, we need to check if s is equal to "yes". We do this by using the comparison operator == between the two. When we are finished comparing, we use the colon : to tell python to execute the block of code below (return "Shutting down"). You also need to indent your code. :slight_smile: This is how is should be when doing if/elif/else statements. But with else, comparing is invalid syntax.


Wow, I simply needed to add the comparison operator ==. My coded didnt copy with the correct indents but I got it now, thank you very much!


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