Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how do i add two matrix and store it in a list in python

x = [
    [1, 2, 3],
    [4, 5, 6],
    [7, 8, 9]
]

y = [
    [1, 2, 3],
    [4, 5, 6],
    [7, 8, 9]
]
z = []

for i in range(3):
    for j in range(3):
        z.append(x[i][j] + y[i][j])

print(z)
 
PREVIOUS NEXT
Tagged: #add #matrix #store #list #python
ADD COMMENT
Topic
Name
6+3 =