Python 3: Insertion Sort comparisons counter
<p>I need to add a counter of total comparisons for my Insertion Sort program but I don't know why I'm getting a total of 0 comparisons!</p>

<p>I know that the comparisons output should be 15 (for my specific array) not 0.</p>

<p>This is my code so far:</p>

<pre><code>def insertionSort(values):
    k = 0
    n = len(values) - 1
    comparisons = 0
    while k+1 &lt;= n:
        i = k
        while values[i] &gt; values[i+1]:
            temp = values[i]
            values[i] = values[i+1]
            values[i+1] = temp
            comparisons += 1 #I think this is wrong
        k = k + 1
    return comparisons, values
</code></pre>

<p>What am I doing wrong?</p>