
Untitled
By: a guest on
Jul 11th, 2012 | syntax:
None | size: 0.51 KB | hits: 21 | expires: Never
def pallin(a, b):
c = a * b
if str(c) == str(c)[::-1]:
pal_list.append([x,y,c])
pal_list = []
pal_start = 100
pal_end = 1000
for x in range(pal_end, pal_start, -1):
for y in range(x, pal_start, -1):
pallin(x,y)
pal_list.sort(key=lambda f: f[2], reverse = True)
if len(pal_list) > 0:
print(len(pal_list)," Palindrome Found! from ",pal_start," to ",pal_end)
print("The Top 3: ")
for i in pal_list[0:3]:
print("Palindrome: ",i[2]," at: ",i[0]," and ",i[1])