Index out of range error when comparing values
<pre><code>a=[8,24,3,20,1,17]
r=[]
for i in a:
    for j in a:
        s=a[i]-a[j]
        r.append(s)
print r
</code></pre>

<p>When I run this program
Why the index out of range error for this question?</p>