Im使用python 3創建隨機骰子列表並添加它們,但是當我嘗試添加它給我的所有總數TypeError:不支持的操作數類型爲+:'int'和'list。該怎麼辦?嘗試總結嵌套列表,但接收錯誤TypeError:不支持的操作數類型爲+:'int'和'list'
count = 0
lista=[[] for q in range(5)]
while count<len(lista):
import random
c=random.randrange(1,7,1)
lista[count].append(c)
count += 1
print(lista)
total=sum(lista)
這是一個更好的方法添加int值.. –