Python: TypeError: 'int' object is unsubscriptable
<p>I have written a program to calculate roots of a Weyl group.  However, I am getting the following error.  </p>

<pre><code>Traceback (most recent call last):
  File "./rootsAn.py", line 58, in &lt;module&gt;
    equals = isequal(x[0],y[0])
TypeError: 'int' object is unsubscriptable
</code></pre>

<p>I've looked up this error, but as far as I can tell, <code>x[0]</code> and <code>y[0]</code> are both arrays, not <code>ints</code>.  My code is:</p>

<pre><code>def innerprod(a,b):
    x = 0
    y = 0
    while x &lt; len(a):
        y += a[x]*b[x]
        x += 1
    return y

def isequal (a,b):
    x = len(a)- 1
    y = 0
    counter = 0
    while y &lt; x:
        if a[y] == a[x]:
            counter+=1
        else:
            counter +=0
        y += 1
    if counter == x:
        return True
    else:
        return False


simplerootsht = []
simpleroots = []
positiverootsht=[]
positiveroots = []
dim = 3

n = 0
while n &lt; dim-1:
        x = []
        s = 0
        while s &lt; dim:
            if s == n:
                x.append(1)
            elif s == n + 1:
                x.append(-1)
            else:
                x.append(0)
            s += 1
        simplerootsht.append([x,1])
        simpleroots.append(x)
        n += 1
for c in simpleroots:
    positiveroots.append(c)
for d in simplerootsht:
    positiverootsht.append(d)

print positiverootsht

for x in positiverootsht:
    for y in simplerootsht:
        equals = isequal(x[0],y[0])
        if equals == True:
            pass
        print x[0], y[0]
        b = innerprod(x[0], y[0])
        a = len(x[0])
        if b == 0:
            pass
        else:
            r = x[1]
            q = r - b
            print r, q
            x = 1
            while x &lt; q: 
                z = [sum(pair) for pair in zip(x[0], x*y[0])]
                if z not in positiveroots:
                    positiveroots.append(z)
                    positiverootsht.append([z,x[1] + y[1]])
                x += 1
</code></pre>

<p>Thanks!</p>
