title: Why do I get a 'valueError' despite explicitly returning the expected number of values?
body: <p>This is merge sort tweaked to count inversions. My code throws an odd error 
  (I'm implementing algos to learn python 3.x).</p>
  
  <blockquote>
    <p>In line 11, </p>
    
    <p>in merge_sort  first_sorted_half, x = merge_sort(arr[:half])<br>
    [Previous line repeated 12 more times]   ValueError: not enough values
    to unpack (expected 2, got 1)</p>
  </blockquote>
  
  <p>Even though I explicitly return two values? I'm new to python 3 so I'd like to understand exactly what's going on here, I can't seem to find a similar issue anywhere. A link to python docs for more on this would also be appreciated!</p>
  
  <pre><code>def merge_sort(arr):
      if len(arr) &lt;= 1:
          return arr
      half = int(len(arr)/2)
      first_sorted_half, x = merge_sort(arr[:half])
      second_sorted_half, y = merge_sort(arr[half:])
      merged_halves, z = merge(first_sorted_half, second_sorted_half)
  
      return merged_halves, x + y + z
  
  
  def merge(first_half, second_half):
      n = len(first_half) + len(second_half)
      i = 0
      j = 0
      split_inversions = 0
      ans = []
      for k in range(n):
  
          if i &gt;= len(first_half):
              ans.append(second_half[j])
              j += 1
              continue
          if j &gt;= len(second_half):
              ans.append(first_half[i])
              i += 1
              continue
  
          if first_half[i] &gt; second_half[j]:
              ans.append(second_half[j])
              j += 1
              split_inversions += len(first_half) - i
          elif first_half[i] &lt; second_half[j]:
              ans.append(first_half[i])
              i += 1
  
      return ans, split_inversions
  
  
  numbers = [3,2,1,4,5,6,8,10,9]
  print(merge_sort(numbers))
  </code></pre>