Jon Ribbens wrote:
> In article <[EMAIL PROTECTED]>, Bruno Desthuilliers wrote:
> >
> > No need to think too long to come up with the most possibly Q&D solution:
> >
> > res = int(str(5 + 7)[-1])
>
> Am I missing something subtle in the question or is there some reason
> that nobody has posted the correct solution:
>
> (a + b) % 10
>
> ?
You're not missing anything. That's the obvious solution. We're just
celebrating our non-Dutchness at the moment.
>>> def bound(value, maxBound):
... while value > maxBound:
... value -= maxBound
... return value
...
>>> bound(5 + 6, 10)
1
>>> bound(8 + 7, 10)
5
See? I'm definitely not Dutch.
--Jason
--
http://mail.python.org/mailman/listinfo/python-list