On 02/01/16 12:45, yehudak . wrote:
> I know the mathematical way to solve it (resulting in 24), but I want a > Python solution. Show us your code. Usually "the mathematical way to do it" works in Python too. Although there will likely be other ways that may sometimes run faster or easier to code. But until we see your code we can't comment on what you are doing. One way to try would be continually dividing by 10 until you get a non-zero remainder. Count the number of divisions necessary. Hint: The divmod() function may help here. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor