天天看点

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]