- 博客(1)
- 收藏
- 关注
原创 回数是指从左向右读和从右向左读都是一样的数,例如12321,909。请利用filter()筛选出回数...
代码如下:def is_palindrome(n): L=str(n) x=len(L) T=[] for i in range(x//2): t=L[i]==L[-1-i] T.append(t) return False not in T'''测试: output = filter(is_palindrome, range(1, 1000)) print('1~1000:', list(output)
2020-06-29 12:04:14
746
3
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人