Python: TypeError: 'tuple' object does not support item assignment
<p>I am writing a simple sort program in python and encounter this error. I want to swap list elements but it returns an error. I am attaching the error and program in question below.</p>

<pre><code>list[i+1] = list[i]

TypeError: 'tuple' object does not support item assignment
</code></pre>



<pre><code>def my_sort(list):
    for index in range(1,len(list)):
        value=list[index]
        i=index-1
        while i&gt;=0:
            if value&lt;list[i]:
                list[i+1] = list[i]
                list[i]=value
                i=i-1
            else:
                break
    return

    input_list=eval(input("Enter list items"))
    my_sort(input_list)
    print(input_list)
</code></pre>
