我正在学习 python 你能帮我解决这个 galois 字段 xor 的代码吗?
def generateGF(a,b):
for x in range(a**b-1):
for y in range(a**b-1):
a[x][y] = bin(x)[2:].zfill(3) + bin(y)[2:].zfill(3) # limited for 2^3
for i in range(a**b):
for j in range(a**b):
print(bin(z[i][j]),end=' ')
print("\n")
print (generateGF(2,3))
我得到这个错误
python lab5.py :(
Traceback (most recent call last):
File "lab5.py", line 9, in <module>
print (generateGF(2,3))
File "lab5.py", line 4, in generateGF
a[x][y] = bin(x)[2:].zfill(3) + bin(y)[2:].zfill(3) # limited for 2^3
TypeError: 'int' object is not subscriptable