title: Pretty Printing (2D Arrays, Box)
body: <p>I have written the following code:</p>
  
  <pre><code>for row in range(len(listOfLists)):
      print('+' + '-+'*len(listOfLists))
      print('|', end='')
      for col in range(len(listOfLists[row])):
          print(listOfLists[row][col], end='|')
      print(' ') #To change lines 
  print('+' + '-+'*len(listOfLists))
  </code></pre>
  
  <p>Input: </p>
  
  <blockquote>
  <pre><code>[['a', 'b', 'c'],
   ['d', 'e', 'f'],
   ['g', 'h', 'i'],
   ['j', 'k', 'l']]
  </code></pre>
  </blockquote>
  
  <p>Output:</p>
  
  <blockquote>
  <pre><code>+-+-+-+-+
  |a|b|c| 
  +-+-+-+-+
  |d|e|f| 
  +-+-+-+-+
  |g|h|i| 
  +-+-+-+-+
  |j|k|l| 
  +-+-+-+-+
  </code></pre>
  </blockquote>
  
  <p>Desired Output:</p>
  
  <blockquote>
  <pre><code>+-+-+-+
  |a|b|c| 
  +-+-+-+
  |d|e|f| 
  +-+-+-+
  |g|h|i| 
  +-+-+-+
  |j|k|l| 
  +-+-+-+
  </code></pre>
  </blockquote>
  
  <p>Which prints a '+-+' around the elements of the 2D array.
  However, my code only works for a square array (n^2).</p>
  
  <p>How can I generalise it so that it works for any variation of array (as long as all lists are equal length)</p>
  
  <p>Thank you</p>