我收到此代码的TypeError: 'int' object is not iterable
:
a = [[1, 2, 3], [3, 10, 11], [5, 6, 7]]
b = list(zip(*a))
total = 0
for i in len(b):
for j in len(i):
total += b[i][j]
total = total/len(b[i])
b[i] = total
我正在尝试获取列表中每个元组的总和,并且应该以类似[9, 18, 21]
的列表结尾。
为什么在运行代码时出现此错误:TypeError: 'int' object is not iterable
?