Finding a pair of entries that are out of order
<p>I am trying to create a function that returns the number of pairs that are out of order.</p>

<p>For example, this function would return <code>6</code> for the argument <code>'DCBA'</code>.</p>

<p>My code so far is:</p>

<pre><code>def calc_out_of_order_pairs(s):
    res = []
    sum = 0
    for i in s:
        for j in s:
            res.append(i+j)

    for test in res:
        if pair[0] &gt; pair[1]:
            sum +=1

    return sum
</code></pre>
