Ensure a variable is divisible by 4

Jonathan Smith smithj at rpath.com
Tue Dec 5 23:55:17 EST 2006


MRAB wrote:
>> if ( x % 4 ) == 0:
>> 	whatever # x is divisible by 4
>>
>> modulus is your friend :)
>>
>> -smithj
> 
> <pendantic>
> It's "modulo"; "modulus" is a different operation.
> </pedantic>
> 

Wikipedia says "modulus may refer to... %, the modulo operator of 
various programming languages"

http://en.wikipedia.org/wiki/Modulus

That being said, you may be right and it may just be a common mistake.

-smithj



More information about the Python-list mailing list