python - List index out of range for random cayley table -
i'm trying write code produce random cayley table getting list index out of range error, can't work out why.
here code:
def randcaytab(n): if not n >= 0: return false table = [] in range(n): table.append([]) j in range(n): k in range(n): (table[j]).append(randint(0,(n-1))) return table
i error on line:
(table[j]).append(randint(0,(n-1)))
any appreciated.
table[i].append(randint(0,n-1))
(the parenthesis didn't harm diminish readibility)
Comments
Post a Comment