Newbie that don't understand

Fredrik Lundh fredrik at
Sat Jun 29 13:16:45 EDT 2002

Martin Ståhl wrote:

> if a == b:
>     print "The absolute values of", a,"and",b,"are equal"
> else:
>     print "The absolute values of a and b are different"
> with the output being:
> The absolute values of 23 and 23 are equal"
> how can 23 and -23 be equal?

"value of" != "absolute value of"

in ordinary math notation, the absolute value of a number
x is written |x|, and is simply what you get if you remove
the sign.

in python, it's usually written:


also see:


More information about the Python-list mailing list