Insertion-sort error in Python
<p>I am trying to make an insertion sorting program that sorted a list in ascending order. I'm getting the error:</p>

<pre><code>line 16, in &lt;module&gt; if listNums[x] &lt; listNums[i]:
</code></pre>

<p>For this program: </p>

<pre><code>    listNums = [54, 21, 76, 43, 65, 98, 65, 32, 34, 38]

    x = 1
    i = 0
    Copy = 0

    for z in range (0, len(listNums)):
           if listNums[x] &lt; listNums[i]:
                  Copy = listNums[i]
                  listNums[i] = listNums[x]
                  listNums[x] = Copy
           i = i + 1
           x = x + 1

    print(listNums)
</code></pre>