Created
May 20, 2018 19:54
-
-
Save accessnash/45129cfbe31e81030552fa075ef0d08d to your computer and use it in GitHub Desktop.
Find the largest palindrome made from the product of two 3-digit numbers. - Project Euler
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 isPalindrome(a,b): | |
| s = str(a*b) | |
| if s == s[::-1]: | |
| return True | |
| palinlist = [] | |
| for i in range(999, 101, -1): | |
| for j in range(999, 101, -1): | |
| num = i*j | |
| if isPalindrome(i,j): | |
| palinlist.append(num) | |
| print(max(palinlist)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment