title: Merge Sort Problems - Python
body: <p>What's wrong with my code? It prints only a part of the vect values. Seems that the while loop breaks at some point. I don't understand why. </p>
  
  <pre><code>def print_list(vect):
      for i in range(0, len(vect)):
          print(vect[i])
  
  def merge_sort(vect):
      left = []
      right = []    
      result = []
  
      for i in range(0, int(len(vect)/2)):
          left.append(vect[i])
      for i in range(int(len(vect)/2), len(vect)):
          right.append(vect[i])
  
      left.sort()
      right.sort()
      i = 0
      j = 0
  
      while i &lt; len(left) and j &lt; len(right):
          if left[i] &lt;= right[j]:
              result.append(left[i])
              i += 1
          else:
              result.append(right[j])
              j += 1
  
      print(len(result))
      return result
  
  vect = [3, 1, 5, 7, 10, 2, 0]
  
  vect = merge_sort(vect)
  </code></pre>