【发布时间】:2020-05-04 22:45:00
【问题描述】:
我正在尝试让我的代码打印此输出。
这是我的代码
outputlist = []
bad_character=['! ', ',']
def is_palindrome(alist):
for element in alist:
for s in word:
if s is bad_character:
continue
my_stack.append(s.lower))
my_stack_reverse=my_stack[::-1]
if my_stack_reverse==my_stack
outputlist.append(True)
else
append(False)
if my_stack_reverse=my_stack
test_list=['Madam', 'A nut for a jar of Tuna', 'I love DSAG']
print(is_palindrome(test_list))
print(test_list)
我正在尝试将此作为我的输出,但输出错误:
[对,对,错]
['女士','一罐金枪鱼的坚果','我爱 DSAG']
【问题讨论】:
-
你有没有尝试过调试这个?我推荐阅读以下文章:ericlippert.com/2014/03/05/how-to-debug-small-programs.
标签: python jupyter-notebook stack