#快速排序deffast_sort(a):iflen(a)<=1:return a
else:#找基准数,也可以是第一个数,或者最后一个数,把比基准数小的放到左边,大的放右边,然后左右两边的再递归排序
mid=a[len(a)//2]
left,right=[],[]
a.remove(mid)for num in a:if num in a:if num>=mid:
right.append(num)else:
left.append(num)return fast_sort(left)+[mid]+fast_sort(right)
a=[1,4,3,5,0,7]print(fast_sort(a))