Created
February 3, 2017 11:07
-
-
Save dsirotkin256/d2a895b9c42373bce68f039ad108830b to your computer and use it in GitHub Desktop.
3 digit palindrome. Output: 997 * 997 = 994009
This file contains hidden or 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 main(): | |
memo = 0 | |
x = 0 | |
y = 0 | |
for i in range(1, 999): | |
for j in reversed(range(1,999)): | |
temp = i * j | |
s = str(temp) | |
if (s[0] == s[-1] and temp > memo): | |
memo = temp | |
x = i | |
y = j | |
print(str(x) + " * " + str(y) + " = " + str(memo)) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment