示例#1
0
def main():
    largest = 0
    for i in range(100, 1000):
        for j in range(100, 1000):
            test = i * j
            if isPalindrome(test):
                if test > largest:
                    largest = test
    print('The largest palindrome is %i' % largest)
示例#2
0
 def testPalindrome(self):
     self.assertEqual(isPalindrome("1"), True)
     self.assertEqual(isPalindrome(100), False)
     self.assertEqual(isPalindrome(101), True)
     self.assertEqual(isPalindrome(10000000), False)
     self.assertEqual(isPalindrome(123000321), True)