Review: Functions


#1



line 3 error expected indented block


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


#2

Everything from line 3 and down needs indentation.


#3

but isn't line 3 indented?


#4

Yes, but not enough.

def fun(arg):
    if something:
        return someting
    elif something_else:
        return something
    else:
        return something

#5

Why this one is not working ?????

def shut_down(s):
return s

if s = "yes":
return ("Shutting down")

elif s = "no":
return ("Shutdown aborted")

else:
return ("Sorry")


#6

This is why the program is not working. It never gets to run the if statement. Remove the line and try again.


#8

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