title: Populating a matrix with only a single list input
body: <p>I have a code snippet that creates a matrix by populating the upper elements one by one and populate the lower elements afterwards (if the upper element is <code>x</code> then the lower is <code>1/x</code>)</p>
  <pre><code>n = 4
  m = np.ones([n, n])
  for i in range(0,n):
      for j in range(0,n):
           if i &lt; j:
               x = input()
               m[i, j] = float(x) 
               m[j, i] = 1 / float(x) 
  </code></pre>
  <p>In the second code I can populate the matrix at once, but I need to populate the elements row-wise from top left to bottom right</p>
  <pre><code>n = int(input())
  entries = list(map(int, input().split()))
  matrix = np.array(entries).reshape(n, n)
  </code></pre>
  <p>My question is: is there any way can I populate the upper triangle of the matrix first like the first snippet, but only by entering a list once like the second snippet?</p>
  <p>Ex.</p>
  <p>n = 3</p>
  <p>Input = 2 3 4 (list)</p>
  <pre><code>Expected output=
  [[1.         2.         3.        ]
   [0.5        1.         4.        ]
   [0.33333333 0.25       1.        ]]
  </code></pre>