tableau = [3, 4, 1, 5, 2, 1] matrice = [] i = 0 for i in range(len(tableau)): j = 0 while len(matrice) > 0 and j < len(matrice) and matrice[j] > tableau[i]: j += 1 matrice.insert(j, tableau[i]) print tableau print matrice