Discuss / Python / 作业

作业

Topic source
# -*- coding: utf-8 -*-

def is_palindrome(n):
    if n >10:
        return str(n) == str(n)[::-1]

output = filter(is_palindrome, range(1, 1000))
print(list(output))

Henry_Smith

#2 Created at ... [Delete] [Delete and Lock User]

这樣的写的话,那些个位数的数就不在这个范围内了,但是实际上个位数的数也是回数。


  • 1

Reply