On 08/13/10 10:46, Peter Otten wrote:
Martin P. Hellwig wrote:

SPOILER ALTER: THIS POST CONTAINS A POSSIBLE SOLUTION
No it wasn't :-)

which should be 1*9 + 2*6

What am I missing?


Aah interesting, 21 % 9 returns 3 instead of 12, which makes sense of course. I guess the algorithm has to be adapted in a way that if the value is bigger or equal twice the size of the modulo value you need to iterate over it, something like:
for minus_multiplier in range(1, int(number, modulo_value)+2):
    number = number - (modulo_value * minus_multiplier)
    do the rest of the loop

Probably another ten lines or so to make it working as it should

--
mph
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to