【发布时间】:2015-04-26 02:28:43
【问题描述】:
import random
stats = []
statslist = []
rollslist = []
for var1 in range(4):
stats.append(random.randrange(1, 7))
rollslist.append(stats)
print(stats)
b = min(stats)
stats.remove(b)
print(sum(stats))
statslist.append(sum(stats))
print(stats)
print(rollslist)
print(statslist)
实际结果
[5, 1, 1, 3]
9
[5, 1, 3]
[[5, 1, 3]]
[9]
预期结果
[5, 1, 1, 3]
9
[5, 1, 3]
[[5, 1, 1, 3]]
[9]
我希望它为第四个结果打印四个数字,而不是它给我的三个。我在删除号码之前附加了列表。我错过了什么?
【问题讨论】:
-
一切都是为了参考。