【发布时间】:2020-12-17 04:31:29
【问题描述】:
我需要编写一个程序,从列表中添加字符串并按顺序输出它们:
1 string
1 + 2 string
1 + 2 + 3 string ...
def spacey(array):
pass
e = ""
i = ""
m = []
for e in list(array):
i += e
return (i)
这给了我所有加在一起的字符串的输出,例如:
Thisismyquestionforyou
但我需要
This
Thisis
thisismy...
【问题讨论】:
-
每次追加字符串时都需要打印,不仅在末尾。
-
具体是什么问题?你做过调试吗?请参阅How to Ask、help center。