title: Python - List is not defined
body: <pre><code>from typing import List, Tuple, Dict, TextIO
  def names(file:TextIO) -&gt; None:
      """ create a list with all the names from the file
      """
      lines = ""
      firstname = ""
      lastname = ""
      name_list = []
      file = open(file, 'r')
      for line in file:
        line = line.strip()
        lines += line
      for i in range(len(lines)):
        if lines[i] == ",":
          lastname += lines[i+2]
          first = i
          last = i + 3
        while lines[first].islower() and lines[last].islower():
          firstname += lines[first]
          lastname += lines[last]
          first -= 1
          last += 1
      name_list.append(firstname + " " + lastname)
  </code></pre>
  
  <p>keep returning the name_list is not defined, where went wrong?</p>