I'm not sure what is wrong with the following code:

```
# given a prime p, return all A_n representations of dimension = p^2
def rankrep(p):
bound = p**2
A = lambda i: WeylCharacterRing("A{0}".format(i), style = "coroots")
deg = []
for i in xrange(bound):
deg.append([])
fw = A(i+1).fundamental_weights()
temp = A(i+1)
for j in range(len(fw)):
deg[i].append(temp(fw[j]).degree())
return deg
```

But when I run it, it is unable to return anything, and tells me `Keyval Error 0`

. Should I not be using `append`

here?

I eventually hope to insert some `if`

trees testing whether a given `temp(fw[j].degree() == p**2`

, but I'm not sure how to pull those indices either. Any help would be greatly appreciated. Regards.