From dc0d6c491a508bae8d298172e4ace3afa7892858 Mon Sep 17 00:00:00 2001 From: Guillaume VALLAT Date: Tue, 26 Nov 2024 10:51:06 +0100 Subject: [PATCH] algo de tri pas opti du tou --- tri.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 tri.py diff --git a/tri.py b/tri.py new file mode 100644 index 0000000..289a714 --- /dev/null +++ b/tri.py @@ -0,0 +1,17 @@ +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]]) \ No newline at end of file