title: TypeError list indices must be integers or slices not str
body: <p>I am new in python and I have the following problem. When I run this code:</p>
  <pre><code>import numpy as np
  
  my_file1 = open(&quot;ex2-dnalist1.txt&quot;)
  my_file2 = open(&quot;ex2-dnalist2.txt&quot;)
  
  lines1 = my_file1.readlines()
  lines2 = my_file2.readlines()
  
  def EditDistanceM(s,t):
      size_x = len(s) + 1    
      size_y = len(t) + 1 
      matrix = np.zeros((size_x, size_y)) 
      for x in range(size_x):
          matrix[x,0] = x
      for y in range(size_y):
          matrix[0,y] = y
      for x in range(1, size_x):
          for y in range(1, size_y):
              if s[x-1] == t[y-1]:        
                  matrix[x,y] = min(
                      matrix[x-1, y] + 1, 
                      matrix[x-1, y-1],   
                      matrix[x, y-1] + 1  
                      )
              else:                      
                  matrix[x,y] = min(
                      matrix[x-1, y] + 1,
                      matrix[x-1, y-1] +1,
                      matrix[x, y-1] + 1
                      )
                  
      print(matrix)
      return (matrix[size_x - 1, size_y - 1])
  
  list_10 = []
  for n in lines1[n]:
      for m in lines2[m]:
          EditDistanceM(lines1[n],lines2[m])
          list_10 += EditDistanceM(lines1[n],lines2[m])
  </code></pre>
  <p>I get the error:</p>
  <pre><code>TypeError                                 Traceback (most recent call last)
  &lt;ipython-input-89-957aaf99b22e&gt; in &lt;module&gt;
       34 
       35 list_10 = []
  ---&gt; 36 for n in lines1[n]:
       37     for m in lines2[m]:
       38         EditDistanceM(lines1[n],lines2[m])
  
  TypeError: list indices must be integers or slices, not str
  </code></pre>
  <p>I get the same error even if I write n=0 and m=0 outside the for loop, but this time for the EditDistancM function inside the two for loops. Can you please help me?</p>