python list subtract another list

description: the elements in a list subtract the same index elements in another list

code for list substraction in python

1
2
3
4
5
l1 = [1,2,3]
l2 = [4,8,3]
dif = list(map(lambda x: x[0]-x[1], zip(l1,l2)))
# output:
# [-3, -6, 0]