I want to check if a multiplication table like the following is not a code but I could not find a way to write it another way
* 0 1 2
0 |0 1 0
1 |0 0 0
2 |0 1 1
It is store as a list with sublists in my code like
[[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]
You should loop over all three variables:
And then you need to check if
for all values.