Discuss / Python / 没有LS大神的好

没有LS大神的好

Topic source

豪梦_Mclean

#1 Created at ... [Delete] [Delete and Lock User]
def is_palindrome(n):
    def f1(n):
        while n > 0:
            yield n%10
            n = n//10
    r = list(f1(n))
    for i in range(len(r)//2):
        if not r[i] == r[-i-1]:
            return False
    return True

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

Henry_Smith

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

沒太明白每句的意思,要是有点注释辅助下就好了。


  • 1

Reply