Python的小问题 我的code运行出来的结果是一样的 但是网站还是说我不对 是我在每个结果后面加space的方法不对吗 我不知道怎么加
要求是
网站显示错误是
graders/exercises/ex02/repeat_beat_test.py:35 - AssertionError: Expected: bop bop bop
but did not get it. Check your spacing and spelling.
Python的小问题 我的code运行出来的结果是一样的 但是网站还是说我不对 是我在每个结果后面加space的方法不对吗 我不知道怎么加
要求是
网站显示错误是
graders/exercises/ex02/repeat_beat_test.py:35 - AssertionError: Expected: bop bop bop
but did not get it. Check your spacing and spelling.
题目中有要求,输出中的重复字符串后面不能有空格。你代码中输出结果字符串中最后多了个空格,所以不能通过。使用strip()处理一下。代码:
while i<maxium:
a += beat+' '
i+=1
else:
if maxium<=0:
a+=error
a=a.strip()
print(a)
如有帮助请点采纳。