回数的判断

#! /usr/bin/env python
count = 0
for i in range(1000,3000):
set = str (i)
if (set[::-1]) == (set[0::]):
count += 1
print(i,"count=",count)
#第二种方法
# def fn(n):
# if str(n)[::-1] == str(n):
# return True
# else:
# return False
#
# output = filter(fn,range(1000,3000))
# print("所有的回数:",list(output))
posted @ 2017-03-13 15:37  Leon_online  阅读(325)  评论(0编辑  收藏  举报