形似1223221,12521均为回文数,给一个正整数你, 求所有这样的五位和六位的十进制数,满足个位数字之和等于n(5<=n<=54)。
1 def specialHuiwen(num): 2 num_list = [] 3 if 5 <= num <= 54: 4 for i in range(10000, 1000000): 5 i = str(i) 6 temp = [int(j) for j in i] 7 if sum(temp) == num and i == i[::-1]: 8 num_list.append(i) 9 else: 10 print 'please input a num in [5, 54]' 11 return num_list