Largest palindrome product
First read the problem description.
def is_palindrome(n):
= n
t = 0
reverse while t > 0:
*= 10
reverse += t%10
reverse //= 10
t return n == reverse
def products(lowerlim, upperlim):
= []
products for a in range(lowerlim, upperlim):
= a
b while b <= upperlim:
*b)
products.append(a+= 1
b return sorted(products, reverse = True)
next(p for p in products(100, 1000) if is_palindrome(p))
906609
Source code of the solution(s):