Mercurial > hg > pub > prymula > scripts
view bubblesort/bubblesort.py @ 9:b2ef499536b0
postagelabels-0.220220-3-PKG_FIX
author | prymula <prymula76@outlook.com> |
---|---|
date | Sun, 04 Feb 2024 18:32:31 +0100 |
parents | dcd610585610 |
children |
line wrap: on
line source
#!/usr/bin/env python3 tab = [3, 10, 1, 4, 5, 9, 8] n = len(tab) for i in range(0, n - 1): for j in range(0, n - i - 1): print ("j: "+str(j)) if (tab[j] > tab[j + 1]): tab[j], tab[j+ 1] = tab[j + 1], tab[j] print(tab)