Given list a, b
a=[[[1.1,-2.1],
[-0.6,4.2]],
[[3.9,1.3],
[-1.3,1.2]]]
b=[[-1.1,4.3],
[-1.4,2.4]]
If I just want to sum the list [[1.1,-2.1],[-0.6,4.2]]
in the list a (not the whole list a) with the list [-1.1,4.3]
in list b.
For instance 1.1+(-1.1) then (-2.1)+4.3 and so on. After that store back to an empty list. Can I do this with for loop?
In this case, the final output will be[[0, 2.2],[-1.7, 8.5]]
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…