交作业啦(看完评论团的结果)
Topic source在Python Shell窗口运行此程序,会报错: File "<pyshell#91>", line 2, in fn return str(n) == str(n)[::-1] TypeError: 'str' object is not callable
str(123)也运行不了。但在Python另一交互模式(黑背景)中却可以运行。
请问,这是什么原因啊?
- 1
在Python Shell窗口运行此程序,会报错: File "<pyshell#91>", line 2, in fn return str(n) == str(n)[::-1] TypeError: 'str' object is not callable
str(123)也运行不了。但在Python另一交互模式(黑背景)中却可以运行。
请问,这是什么原因啊?
BillCode
def is_palindrome(n):
output = filter(is_palindrome,range(1,1000)) print(list(output))