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


#1

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


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


#2

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


#4

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


#5

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


#6

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


#7

@asap_peter ,

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

Does your code test for that condition?


#8

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"


#9

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.


#10

Alternatively, elif s is equal to "no"


#11

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


#12

@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.


#13

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