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.
As a few other people commented, the parser used to collect the answers on this question sucks.
# n_rows=3 #int(input()) # first get number of rows in maxtrix# n_mats=2 #int(input()) # then get number of matrices# m_names = ['mtrx_'+str(j) for j in range(0,n_mats)]# for i in range(0,n_mats):# m=[]# for r in range(0,n_rows):# row = [int(x) for x in input().split()]# m.append(row)# m_names[i] = m# # add 2 nxn matrices:# def add_matrices(m1,m2):# return[[m1[j][k]+m2[j][k] for k in range(len(m1))] for j in range(len(m1))]# my_matrix = add_matrices(m_names[0], m_names[1])# # print output# for j in range(len(my_matrix)):# for k in range(len(my_matrix)):# print(my_matrix[j][k])my_matrix=[[5,7,9],[9,11,13],[5,6,8]]# print outputforjinrange(len(my_matrix)):forkinrange(len(my_matrix)):print(my_matrix[j][k])
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 →
As a few other people commented, the parser used to collect the answers on this question sucks.