Adding two lists element by element
rahim
-
S -
S -
Hello,
I am new to Python
My question is as follows:
I have two lists
L1 = [1, 2, 3] with 3 elements
L2 = [4, 5, 6, 7] with 4 elements
I want to add them element by element to obtain
L1 [1, 2, 3]
+
L2 [4, 5, 6, 7]
-----------------------
L3 = [5, 7, 9, 7]
column by column from left to right, even though my two lists have different lengths.
How can I do this?
Thank you
I am new to Python
My question is as follows:
I have two lists
L1 = [1, 2, 3] with 3 elements
L2 = [4, 5, 6, 7] with 4 elements
I want to add them element by element to obtain
L1 [1, 2, 3]
+
L2 [4, 5, 6, 7]
-----------------------
L3 = [5, 7, 9, 7]
column by column from left to right, even though my two lists have different lengths.
How can I do this?
Thank you