title: List index out of range
body: <p>I was implementing quicksort in python</p>
  
  <pre><code>#QuickSort python
  
  def sort(array):
  
      leftside = []
      rightside = []
      equal = []
  
      pivot = array[0]
  
      if (len(array)&gt;1):
          for item in array:
              if item &lt; pivot:
                  leftside.append(item)
              if item &gt; pivot:
                  rightside.append(item)
              if item == pivot:
                  equal.append(item)
      else:
          print array
  
  
      print sort(leftside) + equal + sort(rightside)
  
  array = [1,2,5,4,6,2,3]
  sort(array)
  </code></pre>
  
  <p>I get the error 
    "pivot = array[0]
  IndexError: list index out of range",  I don't see anything that could cause out of index error in this code. Could you please take a look?</p>