Help funtion 17


#1

help funtion 17

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


#2

You just need to return a string, why call the function when returning?


#3

def shut_down(s):

if s == "yes":
    return "shutting down"
    elif s == "no":
        return "shutdown aborted"
        else:
            return "sorry"

#4

if, elif and else should have the same indent level, given they have to be after each other


#5

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