Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Find the largest palindrome made from the product of two 3-digit numbers.
- def isPalindrome(N):
- strN = str(N)
- if strN == strN[::-1]:
- return True
- return False
- def main():
- N = 1000
- largest, i = 0, 100
- while i < N:
- j = i
- while j < N:
- candidate = i * j
- if candidate > largest and isPalindrome(candidate):
- largest = candidate
- j += 1
- i += 1
- print largest
- if __name__ == "__main__":
- main()
Add Comment
Please, Sign In to add comment