On 1/10/2012 1:47 PM, Noah Hall wrote:
a % b is the remainder operator. It returns what's "left" after dividing a by b.
Not to beat a dead horse- but % is the modulo operator.

It returns the residue class of the 2 operands. When a is positive this is the same as remainder, but not so for negative a.

>>> 5%3
2
>>> -5%3
1
>>>

FWIW the Python documentation (at least as of 2.7.2 has this wrong!)


--
Bob Gailer
919-636-4239
Chapel Hill NC

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to