title: Construct a matrix using a for loop
body: <p>I have calculated 9 matrix elements named sij, with i and j being variables (i,j = [1, 2, 3]). Here, i denotes rows and j columns. Suppose I want a 3x3 matrix that consists of the matrix elements s11, s12, ... s32, s33 (nine elements in total).</p>
  
  <pre><code>s11 = 1
  s12 = 2
  s13 = 3
  (...)
  s33 = 9
  </code></pre>
  
  <p>How can I use for loops to construct a matrix out of these elements? Like this:</p>
  
  <pre><code>matrix = [[s11, s12, s13], [s21, s22, s23], [s31, s32, s33]]
  </code></pre>
  
  <p>So that I get a matrix that looks like this.</p>
  
  <pre><code>matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
  </code></pre>