input: Write a function to implement quick sort.
  assert quick_sort([3,6,8,10,1,2,1]) == [1,1,2,3,6,8,10]
  assert quick_sort([1,4,3,9,6,8,2,7]) == [1,2,3,4,6,7,8,9]
  assert quick_sort([10,9,8,7,6,5,4,3,2,1]) == [1,2,3,4,5,6,7,8,9,10]
output: def quick_sort(arr):
      if len(arr) <= 1:
          return arr
      pivot = arr[len(arr) // 2]
      left = [x for x in arr if x < pivot]
      middle = [x for x in arr if x == pivot]
      right = [x for x in arr if x > pivot]
      return quick_sort(left) + middle + quick_sort(right)