Element-wise addition of 2 lists?

I have now:

list1 = [1, 2, 3]
list2 = [4, 5, 6]

I wish to have:

[1, 2, 3]
 +  +  +
[4, 5, 6]
|| || ||
[5, 7, 9]

Simply an element-wise addition of two lists.

I can surely iterate the two lists, but I don’t want do that.

What is the most Pythonic way of doing so?

17 Answers
17

Leave a Comment