17. review functions


#1

I got it rite the editor is not giving any error but codeacademy does

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

Oops, try again. Your shut_down function threw the following error: maximum recursion depth exceeded


17.Review : Functions
Help me
17.Review : Functions
#2

your if needs to be == to yes or no


#3

Can you help me with this


#4

your if needs to be == to yes or no, you posted this in two different topics


#5

your function has one argument:

def shutdown(s):

So s will hold the value, you pass into the function when calling it. You should use a compare operator (==) to see if it equals yes or no


#6

def shut_down(s):
    if s = "yes":
    return "Shutting Down"
    elif s = "no":
    return "Shutdown aborted"
    else:
    return "Sorry"

File "python", line 2
if s = "yes":
^
SyntaxError: invalid syntax

Please help!!


#7

this is more like it :slight_smile: But you should use two equal signs:

if s == "yes":

two equal signs mean comparing, one equal sign is assigning. Also, take another look at your indent levels


#8

def shut_down(s):
if s == 'yes':
return 'Shutting Down'
elif s == 'no':
return 'Shutdown aborted'
else:
return 'Sorry'


#9

You have a question, or? If you have a question, please make your own topic