[Tutor] Problems with subtraction!

col speed ajarncolin at gmail.com
Wed Jul 7 14:08:09 CEST 2010


On 7 July 2010 18:59, Evert Rol <evert.rol at gmail.com> wrote:

> > The second number should be negative ( I WANT it to be negative). For
> example:
> >
> > print  (0 - t[4])*(t[3] - t[5]) , (0 - t[5])*(t[2] - t[4])   gives :
> >
> > -30895 -935636
> >
> > And in the python shell:
> >
> > >>> -30895 -935636
> > -966531
>
> No, because you have to *subtract* the second answer from the first (
> according to your print statement: print  (0 - t[4])*(t[3] - t[5])  -  (0 -
> t[5])*(t[2] - t[4]) ). So:
> >>> -30895 - -935636
> 904741
>
>
> If you want it to be negative, check the order of your coordinates: maybe
> you need to interchange two variables between one set of parentheses. Or
> maybe you need to subtract absolute values instead (sorry, too lazy to do
> the math to find out what is correct).
>

Yes, it's so simple isn't it? The old double negative. Thanks a lot for your
prompt reply, great.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100707/8b1f2352/attachment.html>


More information about the Tutor mailing list