Problem 004

git-svn-id: file:///srv/svn/euler@22 e5f4c3ec-3c0c-11df-b522-21efaa4426b5
This commit is contained in:
Correl Roush 2010-04-12 15:53:02 +00:00
parent e099ac9357
commit 9d96efdaf3

11
004.py Normal file
View file

@ -0,0 +1,11 @@
def palindrome():
palindromes = {}
for i in range(999, 99, -1):
for ii in range(999,99, -1):
result = str(i * ii)
if result == result[::-1]:
palindromes[i * ii] = [i, ii]
p = sorted(palindromes.keys(), reverse=True)[0]
print 'Palindrome: {0}x{1}: {2}'.format(palindromes[p][0], palindromes[p][1], p)
palindrome()