找出最大的有由个三位数乘积构成的回文数。
def huiwenQ(num): string = str(num) if string == string[::-1]: return True else: return False result = 0 for i in range(999, 99, -1): for j in range(999, 99, -1): product = i * j if product > result and huiwenQ (product): result = product print result
<<<
906609
def内定义的变量默认为局部变量。