import random def qsort(L): if len(L)<=1: return L return (qsort([i for i in L[1:] if i<=L[0]])+L[0:1]+qsort([i for i in L[1:] if i>L[0]])) li = [] for i in range(20): li.append(random.randrange(10,100)) print(li) print(sorted(li)) print(qsort(li))
import random def qsort(L): if len(L)<=1: return L return (qsort([i for i in L[1:] if i<=L[0]])+L[0:1]+qsort([i for i in L[1:] if i>L[0]])) li = [] for i in range(20): li.append(random.randrange(10,100)) print(li) print(sorted(li)) print(qsort(li))