I got stuck!


#1



Replace this line with your code. 

def shut_down(s):
    return  s
   
    if "yes":
     return "Shutting down"
    elif "no":
        return "Shutdown aborted"
    else:
        return "sorry"

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"
Please help me i can´t do this, i´ve tried a lot of different ways to do it


#2

What they mean is if your s is equal to yes meaning,

if s == "yes":

and remove this line,


#3

it doesn´t works like that


#4

Please post your updated code so I can see what is still causing the error. :slight_smile:


#5

f shut_down(s):
return s

if s=="yes":
 return shut_down("Shutting down")
elif s=="no":
    return shut_down("Shutdown aborted")
else:
    return "sorry"

#6

def shut_down(s):
return s

if s=="yes":
 return "Shutting down"
elif s=="no":
    return "Shutdown aborted"
else:
    return "sorry"

#7

For your code to work you need to remove this line,


#8

it doesn´t work, could you write the code so i can copy and paste?


#9

If you didn't got it yet, s does nothing at the return statement.
You should still have the return statement, but you are returning wrong thing.


#10

I strongly disagree with just giving code because in doing so you will not learn and understand how to fix your problem but just how to get around it so if you'd like we can go step by step and I will help you understand how to fix the errors. :slight_smile:


#11

f shut_down(s):
return s

 if s=="yes":
 return "Shutting down"
elif s=="no":
    return "Shutdown aborted"
else:
    return "sorry"

i have this code currently, could you explain me how can i return shutting down correctly?


#12

It's all about your first return- statement that you removed. It should still return something


#13

This exersice is pretty interesting, because of the function doesn't have a value but it still has three if- expressions.


#14

i think im gonnna wait for someone else to respond my doubt


#15

Just test things up. You should return itself the name of the function, I don't understand why you have to do it, the function has no value. But return itself the function.

return shut_down

Damned. Just add it before your if statements.


#16

i`ll wait, thanks by the way


#17

Doesn't it let you ahead yet?


#18

nope and i tried what you said


#19

I told you to edit the first return statement!!!

def shut_down(s):
    return shut_down

The beginning of the function should look like this. I thank that you understood it...


#20

i did it that way already!