[Tutor] why does this not work

Danny Yoo dyoo at hashcollision.org
Tue Apr 23 22:17:12 CEST 2013


Hi Roelof,

On Tue, Apr 23, 2013 at 1:39 PM, Roelof Wobben <rwobben at hotmail.com> wrote:
> Im trying to learn python by a course at codeacademy.
>
> Now I have this code :
>
> def shut_down(s):
>     s = s.lower()
>     if s == "yes":
>         return "Shutting down..."
>     elif s == "no" :
>         return "Shutdown aborted!"
>     else:
>         return "Sorry, I didn't understand you"
>
> But when I run it  I see this message:
>
> It looks like output other than yes/no does not return "Sorry, I didn't
> understand you."


What inputs are you testing?  What output do you get?

You were doing fine, but summarized a little bit too much at the end.
Unlikely as it might seem, those details might matter, or at the very
least may help us discount certain possibilities.  Can you show us how
you're testing it?


(One of those "silly" possibilities: the function you're calling might
not be the function you've defined.  You call your function
shut_down(), but given that underscore, maybe you've defined a
function "shutdown" by accident?  It's those sort of niggling details
we need to discount; without seeing how you're doing your testing, we
have to leave that distant possibility open.)


More information about the Tutor mailing list