re OnInteger division

John Thingstad john.thingstad at chello.no
Wed Nov 7 09:24:14 EST 2001


In iteger arithetric divsion is no the oposite of multiplication.
As pointed out (9 / 4) * 4 = 8
Why?
9 / 4 = 2
2 * 4 = 8
To achive a inverse you need to use the modulo as well

so:
9/4 = 2
9 %4 = 1

and
(9/ 4) *4 + (9%4) = 9







More information about the Python-list mailing list