#construct the matrix matrix = [[1, 2], [4, 3]] #iterate over the matrix summing all elements in the row #give those row summations into a list #sum the list to give you the answer ans = sum([sum(row) for row in matrix]) print(ans) 10