readme
This commit is contained in:
12
tri.py
12
tri.py
@@ -1,12 +1,14 @@
|
||||
def tri(t):
|
||||
# Trier chaque sous-liste individuellement
|
||||
for tab in t:
|
||||
tab.sort()
|
||||
for i in range(len(tab)):
|
||||
for j in range(len(tab) - 1):
|
||||
if tab[j] > tab[j + 1]:
|
||||
tab[j], tab[j + 1] = tab[j + 1], tab[j]
|
||||
|
||||
for i in range(len(t)):
|
||||
for j in range(i + 1, len(t)):
|
||||
if t[i][0] > t[j][0]:
|
||||
t[i], t[j] = t[j], t[i]
|
||||
for j in range(len(t) - 1):
|
||||
if t[j][0] > t[j + 1][0]:
|
||||
t[j], t[j + 1] = t[j + 1], t[j]
|
||||
|
||||
print(t)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user