Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def tri_bulle(tableau):
- permutation = True
- passage = 0
- while permutation == True:
- permutation = False
- passage = passage + 1
- for en_cours in range(0, len(tableau) - passage):
- if tableau[en_cours] > tableau[en_cours + 1]:
- permutation = True
- # On echange les deux elements
- tableau[en_cours], tableau[en_cours + 1] = tableau[en_cours + 1],tableau[en_cours]
- return tableau
- print(tri_bulle([2, 5, 7, 1, 4, 8, 10, 6]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement