We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
a1 = [1,2,3]
a2 = [2,3,4]
a3 = [1,1,1]
A = [a1,a2,a3]
b1 = [4,5,6]
b2 = [7,8,9]
b3 = [4,5,7]
B = [b1,b2,b3]
c1 = []
c2 = []
c3 = []
C = [c1,c2,c3]
for n in range(len(A)):
for i in range(len(A[n])):
C[n].append(A[n][i] + B[n][i])
# C[0].append("string")
# C[0].append("string")
for n in range(len(C)):
for i in range(len(C[n])):
print int(C[n][i])
I don't get it. My code outputs:
5
7
9
9
11
13
5
6
8
But it still says the answer is wrong. I wrote and tested my code on repl.it and it printed out fine in the display there.
Am I losing my mind?
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Linear Algebra Foundations #1 - Matrix Addition
You are viewing a single comment's thread. Return to all comments →
I don't get it. My code outputs:
But it still says the answer is wrong. I wrote and tested my code on repl.it and it printed out fine in the display there.
Am I losing my mind?