Why it said "return outside function" in line 5


#1



def shut_down(s):
    return s
if shut_down():
    s=='yes'
    return "shutting down"
elif shut_down():
    s=='no'
    return "shutdown aborted"
else:
    return "sorry"


#2

someone should reply to this we need help


#3

The return statement only makes sense inside functions.

look at your code

def shut_down(s):
    return s
if shut_down():
    s=='yes'
    return "shutting down"

your if else should be inside of the function.
now inside of if your return keyword isn't inside function.

also you should know function ends the moment a return keyword is reached

i just told about error massage.try the rest


#4

kindly do it as you say


#5

did you slove your problems?do you need any help?


#7

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