Created
May 19, 2014 19:36
-
-
Save goyuninfo/06037c0ad5fbebce74bb to your computer and use it in GitHub Desktop.
Project Euler Problem 4 Largest palindrome product
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def is_palindrome(n): | |
"""Return True if n is a palindrome; False otherwise.""" | |
s = str(n) | |
return s == s[::-1] | |
from itertools import product | |
print max(x * y for x, y in product(range(1000), repeat=2) if is_palindrome(x * y)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment