mirror of
https://github.com/correl/euler.git
synced 2024-11-23 19:19:53 +00:00
Problem 004
git-svn-id: file:///srv/svn/euler@22 e5f4c3ec-3c0c-11df-b522-21efaa4426b5
This commit is contained in:
parent
e099ac9357
commit
9d96efdaf3
1 changed files with 11 additions and 0 deletions
11
004.py
Normal file
11
004.py
Normal 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()
|
Loading…
Reference in a new issue