Review: Function Help, Its going crazy


#1


https://www.codecademy.com/courses/python-beginner-c7VZg/4/1?curriculum_id=4f89dab3d788890003000096#


It says that i should try again and "Your function failed on the message yes. It returned 'yes' when it should have returned 'Shutting down'"

It printed Shutting Down but then i gave me the error


def shut_down(s):
    return s
    
if shut_down("Yes"):
    print "Shutting down"
elif shut_down("No"):
    print "Shutdown aborted"
else:
    print "Sorry"
shut_down("Yes")


#2

In order to activate your if elif statement, it should be in the function shut_down, not outside of it.


#3

Remember that print is not return.


#4

The if and elif statements are part of the function.


#6

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