Functions.17: some one plz tell me what I'm doing wrong


link to leson:

so this is my code

as you can see, no matter what i do, the error message stays the same

further more, i am quite confused as to why my code should have returned 'Shutdown aborted' as this was not in the lessons instructions


Can you spot the difference between your code and the error statement?


ye, ones my code and the others and error message :laughing:


Look more closely for textual differences, meaning examine your strings.


You seriously think I didn't notice that the error message reads "it should have returned 'shutdown aborted'"?


@asap_peter ,

Under what condition do the instructions state that the function should return "Shutdown aborted"?

Does your code test for that condition?


ye i know that screen shot doesn't meet that condition, that was just me testing my code for the dozenth time to see if the error message works properly. If you looked carefully, you would have seen that the error message reads "it returned 'sorry'". However, the console tells me that the value my function returned was "shutting down"


You currently have this statement ...

print shut_down("yes")

You could initiate some testing by changing the argument that you pass to the function to the value that you expect would output the message "Shutting down". Try that to see whether it does what you expect.

If it does not do as expected, then make sure your condition is specified correctly. For some example code that might have the correct condition, you can take a close look at the elif header within the code in this post.


Alternatively, elif s is equal to "no"


check my post again, i dont think i was clear enough with my question


@asap_peter ,

If you submit code that contains a function, Codecademy usually tests your function by passing it various arguments to check whether it returns correct results. In this case, it passed your shut_down function a string, as an argument, that should have caused it to return 'Shutdown aborted'. Instead, the function, as you wrote it, returned 'Sorry'.

The remedy is for you to test your function for each relevant argument value to find out whether it returns the correct result, when passed each of those values. Check the instructions carefully to make sure your code conforms to the given specifications.


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