[python]filter-取得回数
270 ワード
def is_palindrome(n):
theStr = str(n)
theStr2 = ''
for char in theStr:
theStr2 = char + theStr2
if theStr2 == theStr:
return True
else:
return False
print filter(is_palindrome, range(1, 1000))