Mercurial > hg > pub > prymula > scripts
comparison bubblesort/bubblesort.py @ 0:dcd610585610
INIT
author | prymula <prymula76@outlook.com> |
---|---|
date | Thu, 21 Sep 2023 22:32:14 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:dcd610585610 |
---|---|
1 #!/usr/bin/env python3 | |
2 | |
3 tab = [3, 10, 1, 4, 5, 9, 8] | |
4 | |
5 n = len(tab) | |
6 | |
7 for i in range(0, n - 1): | |
8 for j in range(0, n - i - 1): | |
9 print ("j: "+str(j)) | |
10 if (tab[j] > tab[j + 1]): | |
11 tab[j], tab[j+ 1] = tab[j + 1], tab[j] | |
12 | |
13 print(tab) |