In [1]:
def is_palindrome(n):
s = str(n)
return s == s[::-1]
largest = 0
for m in range(999, 99, -1):
if m*999 < largest:
break
for n in range(1000, m-1, -1):
product = m*n
if is_palindrome(product) and product > largest:
largest = product
break
print(largest)
In [ ]: