例如[1,2]与[11,25]的对位相加得到[12,27],对位相减得[-10, -23],对位相乘得[11,50]等。
最简单的例子:
aa = [3,50]
bb = [16,7]
aa = map(lambda x,y: x+y, aa,bb)
print aa
#output: [19, 57]
累积运算的例子:
acc = [0,0,0,0]
for i in range(3):
inc = [i3,i+5]2
acc = map(lambda x,y: x + y, acc, inc)
print acc
#output: [9, 18, 9, 18]
acc = [0,0,0,0]
for i in range(3):
inc = [i3,i+5]2
acc = map(lambda x,y: x - y, acc, inc)
print acc
#output: [-9, -18, -9, -18]