Review Functions indent issues!


#1

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/courses/python-beginner-c7VZg/4/1?curriculum_id=4f89dab3d788890003000096

<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

```python

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

<do not remove the three backticks above>

#2

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.


#3

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!


#4

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