li, r = [23,8, 45, 5, 0, -6, 745,8, 8], [] while (len(li) > 0): loop_, min, tag = len(li), li[0], 0 for i in range(0, loop_, 1): chk = li[i] if min > chk: min, tag = chk, li.index(chk) r.append(min) del li[tag]