【发布时间】:2017-10-26 07:15:09
【问题描述】:
我的代码没有产生我想要的正确输出。这是我的代码:
def rows(numbers):
count = 0
for i in numbers:
if count == 3:
print(i, end = " ")
count = 0
else:
print(i, end = " ")
count += 1
接下来,我将展示我程序中的输出,然后是正确的输出(注意数字是随机的):
91 77 14 36 1 88 13 88 19 40 90
正确的输出显示如下:
91 77 14 36
1 88 13 88
19 40 90
【问题讨论】:
-
如果 count 为 3,您想要添加一个换行符。
if count == 3: print(i) -
哇,我不敢相信我错过了。感谢您的帮助!
-
如果您想要另一种解决问题的方法,您可能会看到我的回答。
标签: python python-3.x