[Tutor] Converting integers into digit sum (Python 3.3.0)

Rafael Knuth rafael.knuth at gmail.com
Mon Dec 9 14:42:47 CET 2013


>> Tu sum it up (aha!): you algorithm is the right and only one
>
> No, it's not the only one. It's certainly the most obvious one, but there is
> also the pure numbers approach pointed out by me and Alan.

So far I received 7 different alternative suggestions, both pure
numbers & mixed int/str approach, which is great because I learn far
more than I would expect given that the subject discussed is a tiny,
little string to digit sum program. I play around with each piece of
code I receive, I take notes and I memorize as much as possible for
upcoming challenges. Although it's sometimes confusing to me as a
novice to programming, I actually like the idea that one and the same
task can be solved in different ways in Python (it spurs my
creativity). And, again: Thank you all for your elaborate and
extremely helpful responses!


More information about the Tutor mailing list