fork download
  1. def __add__(self, other):
  2. result = []
  3. matrix_size = self.size()
  4.  
  5. if self.size() == other.size():
  6. for i in range(matrix_size[0]):
  7. row = []
  8. for j in range(matrix_size[1]):
  9. row.append(self.matrix[i][j] + other.matrix[i][j])
  10. result.append(row)
  11. return Matrix(result)
Success #stdin #stdout 0.02s 27720KB
stdin
Standard input is empty
stdout
Standard output is empty