A challenge from the Mensa Puzzle Calendar

Marco Mariani marco at sferacarta.com
Thu Oct 3 19:23:46 EDT 2002


On Thu, Oct 03, 2002 at 10:00:03PM +0200, Marco Mariani wrote:

> import string
> print [ (x,y,x*y) for x in range(1000) for y in range(100)
>         if map( lambda a: string.count(str(x)+str(y)+str(x*y),a),
>         map(str,range(10)))==[1]*10 ]
> 
> (yes, this goes directly into the python hall of shame together with
> my operator module)
     ^^^^^^^^

Ehm, pointer module.

BTW, i've tried with permutations but it's even slower, having to loop
10! times...





More information about the Python-list mailing list