title: How to construct a symmetric matrix in Python
body: <p>I have the following</p>
  
  <pre><code>Import numpy as np
  
  Mat1 = np.array([[1, 2, 3],
              [0, 4, 5],
              [0, 0, 6]])
  Mat2 = np.transpose(Mat1)
  for i in range(3):
      for k in range(3):
          if i == k:
              Mat2[i,k] = 0
  Mat = Mat2 + Mat1
  print(Mat)
  </code></pre>
  
  <p>But my answer gives me </p>
  
  <pre><code>[[0 2 3]
   [2 0 5]
   [3 5 0]]
  </code></pre>
  
  <p>when I should have <code>1, 4, 6</code> in the diagonal. Can anyone see why?</p>