from random import randint
def qsort(seq): if len(seq) < 2: return seq middle = seq[0] larger = [] smaller = [] for i in seq[1:]: if middle < i: larger.append(i) else: smaller.append(i) return qsort(smaller) + [middle] + qsort(larger) if __name__ == '__main__': alist = [randint(1,100) for i in range(20)] print(alist) print(qsort(alist)