Verbose and flexible args and kwargs syntax

Dave Angel d at davea.name
Mon Dec 12 13:04:34 EST 2011


On 12/12/2011 12:46 PM, gene heskett wrote:
> On Monday, December 12, 2011 12:44:27 PM Chris Angelico did opine:
> <snip>
>> This is the basis of the grade-school "casting out nines" method of
>> checking arithmetic. Set c=9 and you can calculate N%c fairly readily
>> (digit sum - I'm assuming here that the arithmetic is being done in
>> decimal); the sum of the remainders should equal the remainder of the
>> sum, but there's the inherent assumption that if the remainders sum to
>> something greater than nine, you digit-sum it to get the true
>> remainder.
>>
>> (Technically the sum of the digits of a base-10 number is not the same
>> as that number mod 9, but if you accept that 0 == 9, it works fine.)
>>
>> ChrisA
> And that is precisely the reason I have failed to understand why the 1-10
> decimal system seems to have hung on for several hundred years when it is
> clearly broken.
>
I assume this was facetious, but in case not, I'd point out that any 
other number base will have similar modulo characteristics, except for 
base 2, where all numbers are congruent modulo 1, so it doesn't do much 
for checking values.

For example, if you were using a number system of base 8, you could do 
"casting out sevens" by adding the digits together.

-- 

DaveA




More information about the Python-list mailing list