Functions Review


What am I doing wrong? This is from 17.Review: Functions:

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

When I run it in Codeacademy I don’t get any output in the console


Be sure that your text phrases match the instructions exactly. We cannot tell if there are any indentation errors since you haven’t formatted your post.

Please remember to include a link to the exercise and any error messages. Thanks.


@mtf Thank you Roy. I am new in CodeAcademy Community Forums. I have just familiarized myself with how to format my code when posting. Does it look better now?


Yes, since it helps us examine that aspect, as well. Python depends upon indentation to determine block scope.

Did you check your strings? Can we have a link to the exercise so we can check?


@mtf How/where do I get a link to the exercise?


Copy the URL in the location bar and paste it into a post (or the OP if you can still edit). Remember to include error messages, too. Thanks.




Because there is nothing printed. That’s what is expected. If you wish to test it, write three print statements…

print shut_down('yes')
print shut_down('no')
print shut_down('yup')

You should be able to pass the lesson without testing, but feel free to test after you pass.


I guess I was mistaken in how to properly call the function. I was just trying to call it with


where I should actually be calling it with

print shut_down(string)

Sorted it out. Thanks


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