old_contents: def getDec(n):
      lst = []
      while n>0:
          lst.append(n%10)
          n /= 10
      return lst
  
  
  def isPalind(n):
      lst = getDec(n)
      ln = len(lst)
      for i in range(ln/2):
          if lst[i] == lst[ln-i-1]:
              continue
          else:
              return False
      return True
  
  
  import sys
  n = 999999
  while 1:
      if isPalind(n):
          for a in range(100,1000):
              if n % a == 0:
                  b = n / a
                  if b>=100 and b < 1000:
                      print a,b,n
                      sys.exit()
      n -= 1
  
new_contents: #! /usr/bin/env python
  def getDec(n):
      lst = []
      while n > 0:
          lst.append(n % 10)
          n /= 10
      return lst
  
  
  def isPalind(n):
      lst = getDec(n)
      # faster than return lst1 == lst1.reverse()
      ln = len(lst)
      for i in range(ln / 2):
          if lst[i] == lst[ln - i - 1]:
              continue
          else:
              return False
      return True
  
  
  maxval = 0
  for x in xrange(1000, 100, -1):
      for y in xrange(x, 100, -1):
          p = x * y
          if p > maxval and isPalind(p):
              maxval = p
  print maxval
  
subject: update 004.py