[Tutor] Help with exceptions please
Wayne Werner
waynejwerner at gmail.com
Sat May 14 05:05:31 CEST 2011
On Fri, May 13, 2011 at 7:48 PM, Lea Parker <lea-parker at bigpond.com> wrote:
> Hello
>
>
>
> I have another assignment I am trying to fine tune. The idea is to make
> sure exceptions work. I have come up with a problem when testing my code.
> When I enter a golf score for a player the program returns the ‘error that
> has occurred’. I only want it to do this if someone doesn’t enter an number.
> <snip>
>
I don't have a lot of time to look at it right now, but what happens when
you remove the final except?
Having a catch-all can hide all sorts of exceptions. If you remove that,
then python should tell you what kind of error it got. That traceback will
be much more helpful than 'error that has occurred'.
If that doesn't help you fix the problem, then remember the three things you
need:
1. What did I do?
2. What did I expect would happen?
3. What happened instead?
For 3, that also means that you should post all the (relevant) output. That
means errors, and usually correct output, especially if there's not a whole
lot of it.
HTH,
Wayne
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110513/9f38eec5/attachment.html>
More information about the Tutor
mailing list