我想检查像下面这样的乘法表是否不是代码,但我找不到另一种写法
* 0 1 2
0 |0 1 0
1 |0 0 0
2 |0 1 1
它在我的代码中存储为带有子列表的列表,例如
[[0,1,0], [0,0,0], [0,1,1]]
#How to write a function which checks elements satisfy the condition x*(y*z) = (x*y)*z ?
#This is what I have so far:
def is_associative(X):
n = len(X)
a = []
for i in range(n):
a.append[i]
for j in range(n):
a[j]*a[j] = X[j]