a = range(100, 1000)
b = range(100, 1000)

"""
Explanation: Project Euler: Problem 4
https://projecteuler.net/problem=4
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.
Find the largest palindrome made from the product of two 3-digit numbers.
First, I defined two lists which hold the values of all three digit numbers
End of explanation
"""


lst = []

"""
Explanation: Then I created an empty list, which would hold all the palindromes created from multiplying those three digit numbers.
End of explanation
"""


for x in a:
    for y in b:
        p = x * y
        if str(p) == str(p)[::-1]:
            lst.append(p)

"""
Explanation: Using two for loops, I looped through all the values in a, multiplying them by all the possible values of b, and calling the product p.  Using an if statement, I turned the product into a string and compared whether it was the same fowards as backwards.  If it was, I appended it to my list of palindromes.
End of explanation
"""


print(max(lst))

# This cell will be used for grading, leave it at the end of the notebook.

"""
Explanation: Finally, I printed the maximum palindrome using the built in max function.
End of explanation
"""


