Discuss / Python / 请问大家这样写为什么不对啊

请问大家这样写为什么不对啊

Topic source

def ispalindrome(n): for a in range(0, len(n)-1): if n[a-1] == n[-a]: yield n else: pass output = filter(ispalindrome, range(1, 1000)) print(list(output))

结果输出了1-1000所有的数。。

Flybor

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

int 哪来的len()


  • 1

Reply