随便输入一个数判断是不是回数

1
2
3
4
5
6
7
8
9
10
11
12
13
# -*- coding: utf-8 -*-
def Judegent_number():
i = int(input(">>> "))
s = list(filter(lambda n:int(str(n)[::-1])==n,range(1,i+100)))
if i in s:
f = str(i)
if len(f) <= 3:
print(f[:-1],"+",f[len(f)//2:])
else:
print(f[:len(f)//2],"+",f[len(f)//2:])
print(i,"是回数")
else:
print(i,"不是回数")

这个应该不用解释,有基础的看得懂