First commit
This commit is contained in:
18
IUT/Info1/TD/Exercices/exam1/test.py
Normal file
18
IUT/Info1/TD/Exercices/exam1/test.py
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
|
||||
|
||||
def tri_selection(tab):
|
||||
for _ in range(len(tab) - 1):
|
||||
for j in range(len(tab)-1):
|
||||
if tab[j] == 0:
|
||||
temp = tab[j]
|
||||
tab[j] = tab[j+1]
|
||||
tab[j+1] = temp
|
||||
return tab
|
||||
|
||||
liste = [0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0]
|
||||
|
||||
tri1 = tri_selection(liste)
|
||||
|
||||
print(liste)
|
||||
print(tri1)
|
||||
Reference in New Issue
Block a user