On 08/07/2008, Christopher Spears <[EMAIL PROTECTED]> wrote:
>  Basically, if the two the x values are the same, I will get a 
> ZeroDivisionError.  A line in this
> case would simply point straight up.  What would slope be in this case?  I 
> will admit that
> this is probably a math problem not a programming one, but I decided to run 
> it by you
> anyway.

The slope in this case is undefined.  Throwing an exception seems to
be a pretty reasonable way of dealing with this case, to be honest.
(although if you're keen, you could define your own
"UndefinedSlopeError" or "VerticalLineError" exception and raise that
instead of the ZeroDivisionError)

-- 
John.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to