'' Traverse the matrix and calculate  sum of each row and column
for i in range ( N ) : NEW_LINE INDENT for j in range ( M ) : NEW_LINE INDENT row_sum [ i ] += A [ i ] [ j ] NEW_LINE col_sum [ j ] += A [ i ] [ j ] NEW_LINE DEDENT DEDENT sum_list = [ ] NEW_LINE