How to fix typeerror: 'list' object not callable error in bubble sorting a list while working in Python : <p>I was trying to sort a list using bubble sort and had written this code, but an error showing typeerror:'list' object not callable came. Where did I make a mistake?</p>

<p>I have tried to enter my list elements in different ways, ie, including decimal numbers etc. but still doesn't work.</p>

<pre><code>def swap(a,b):
    if a &gt; b:
        t = a
        a = b
        b = t
        return a,b
def sort(list):
    k=0
    for i in range(len(list)):
        for j in range(len(list)):
            if list[j] &gt; list[j+1]:
                (a,b) = swap(list[j],list(j+1))
                list[j] = a
                list[j+1] = b
                k+=1    
                print(k,'  ',list)
            else:
                k+=1
                continue

    print(list)

list = [5,6,89,2,1,42,23,46,0,83]
sort(list)
</code></pre>

<p>I expect the list as [0,1,2,5,6,23,42,83,89]</p>
