On 23/08/07, R. Alan Monroe <[EMAIL PROTECTED]> wrote:
> I wrote a lame, but working script to solve this in a few minutes. A
> fun puzzle.
>
> http://weblogs.asp.net/jgalloway/archive/2006/11/08/Code-Puzzle-_2300_1-_2D00_-What-numbers-under-one-million-are-divisible-by-their-reverse_3F00_.aspx

>>> [n for n in xrange(1,1000001) if str(n) != str(n)[::-1] and n %
int(str(n)[::-1]) == 0 and n % 10 != 0]
[8712, 9801, 87912, 98901, 879912, 989901]

:-)

-- 
John.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to