

def bubble_sort(a):
    "\n    Sorts the list 'a' using Bubble sort algorithm\n\n    >>> from pydsa import bubble_sort\n    >>> a = [3, 4, 2, 1, 12, 9]\n    >>> bubble_sort(a)\n    [1, 2, 3, 4, 9, 12]\n\n    "
    for k in range(len(a)):
        flag = 0
        for i in range(0, ((len(a) - k) - 1)):
            if (a[i] > a[(i + 1)]):
                (a[i], a[(i + 1)]) = (a[(k + 1)], a[i])
                flag = 1
        if (flag == 0):
            break
    return a

dataset/ETHPy150Open pydsa/pydsa/pydsa/bubble_sort.py bubble_sort/VarMisuse@91/199 `i`->`k`