Error trying to add +1 to value returned from list
<p>I have a list of lists I am trying to use as a matrix.  In the last line of code when I add '+ 1' to the first argument in the min() function I get an error 'TypeError: can only concatenate list (not "int") to list'.  Can someone help me with the correct way to add one to the value I am calling from the list to compare?  Thanks! </p>

<pre><code>   matrix = []
   for j in range(0,j+1):
       matrix.append([])
   j = len(t)
   for j in range(0,j+1):
       i = len(s)
       for i in range(0,i+1):
           matrix[j].append([i])
   matrix[j][i] = matrix[j-1][i-1]
   j = len(s)
   for j in range(1,j+1):
       i = len(t)
       for i in range(1,j+1):
           matrix[j][i]= min((matrix[j-1][i] +1), (matrix[j][i-1]))
</code></pre>

<p>Probably, you should replace:</p>

<pre><code>matrix[j].append([i])
</code></pre>

<p>with</p>

<pre><code>matrix[j].append(i)
</code></pre>

<p>You want to append integers to list, one matrix row to be:</p>

<pre><code>[0, 1, 2, 3, ...]
</code></pre>

<p>While you append lists to the list, which creates a row in the matrix as </p>

<pre><code>[[0], [1], [2], ...]
</code></pre>

python list python-3.x