#求1000以内的回文数 #1 2 3 2 1 # 1~9 #11 22 33 .... #101 111 121 131... num = 1 while num < 1000: #判断num是不是回文数 if num < 10: print(num) elif num >= 10 and num < 100: if num % 11 == 0: print(num) else: f = num % 10 h = num // 100 if f == h: print(num) num = num + 1