天天看點

python多個清單對應位置元素相加

a = [1,2,3]
b = [4,5,6]
c = [(a[i]+b[i])/2 for i in range(0,len(a))]
print(c)
結果為:[2.5, 3.5, 4.5]