def function_tri(tableau): for tab in tableau: for i in range(1, len(tab)): for i in range(1, len(tab)): if tab[i] < tab[i-1]: a = tab[i] tab[i] = tab[i-1] tab[i-1] = a for i in range (1, len(tableau)): for i in range (1, len(tableau)): if tableau[i][0] < tableau[i][0]: a = tableau[i] tableau[i] = tableau[i-1] tableau[i-1] = a print(tableau) function_tri([[4,0,3], [5,3,2], [3,6,5]])