problems with looping, i suppose

akameswaran at akameswaran at
Mon Mar 27 21:21:16 CEST 2006

Ok I felt a little bad for my quick answer, these just seem like
homework problems.

first problem - it's scope.  (there are two scope errors in the sample)
white space is meaningful.  get consistent with tabs or spaces, or
choose an editor that replaces tab press with space.  It'll make life a
lot easier.  And make copy and paste from the group easier for people
trying to help :)

Second problem (leap year) , you are catching the wrong kind of
exception in that problem, so it's bubbling out as an unhandled
exception.  Use IDLE as a starting point, it's not much - but it would
quickly expose these kinds of proboems.
Run your code using idle or the interactive and you will see what is
going on.

As a side issue.  On the second problem - you did say you just want to
quit in the event of non numeric input, so it's WAD.  But the
underlying exception generated is not a NameError.  Try catching any
error and printing it.

More information about the Python-list mailing list