code: def length_from_nodelist(self, nodelist):
          
          cost = 0
  
          for n1, n2 in zip(nodelist[0:len(nodelist) - 1], nodelist[1:len(nodelist)]):
              cost += self._problem.distance(n1, n2)
  
          return cost
docs: Returns the route length (cost) from the first to the last node in nodelist