Discuss / Python / 作业 有个疑问

作业 有个疑问

Topic source

Achen_Fyc

#1 Created at ... [Delete] [Delete and Lock User]
def is_palindrome(n):
    i=str(n)
    return i == i[::-1]

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

我这块是转化成Str比较的,但是过滤出来的还是int,这是为什么啊?

x1ang_li

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

我本机亲测,这段代码没有问题


  • 1

Reply