help with negative numbers please

Carel Fellinger cfelling at iae.nl
Mon Dec 20 17:32:19 EST 1999


Jim Mace <jmace at ior.com> wrote:

> If I have an equation like this: y = z - x.  How can I get y to equal either
> a negative or positive number.

in expressions Python uses == rather then =, and abs() does the rest:

>>> [ abs(y) == abs(z-x) ] == [ (y == z-x) or (-y == z-x)]
1

-- 
groetjes, carel



More information about the Python-list mailing list