[Tutor] A recreational math problem for Useless Python

Rob Andrews rob@jam.rr.com
Wed, 15 Aug 2001 16:25:38 -0500

Daniel Coughlin wrote:
> Well I know this is not a very good solution - but it is my first attempt.
> I used the random module to create the number sets ad that can take a long time.
> Is there a better way of going about creating the sets? (I dont want to check
> the article yet - besides i doubt i will understand any of it ;-)
> The other problem I encountered which is probably soaking up time is that there
> is an unaccounted for runtime error that happens periodically. I handle this,
> but i know it still happens, and it is knawing at me... If anyone can
> figure out way that happens, I'd love to know.
> One thing you will notice is that you can change the level of precision by
> changing the string slice indexes.
> To get two decimal places over usually takes between 5 and 15 seconds. But
> sometimes it takes a while.
> BTW - I *really* like problems like this - If you have any others, I'd love to
> hear about them.

It took me long enough, but your solution has been posted to Useless
Python. If you truly enjoy this sort of problem, take a look at some of
the (hundreds of) ACM problems available:



A {} is a terrible thing to waste.
Useless Python!