The problem is in matrix.append([(x+1), vectorY[x][1]])
.
As much as the value of vextor[x][1]
is different from (x+1)
, when it is added it will receive the same value of (x+1)
, leaving an array with two equal values, ex: ([1,1])
This is full code link: link
def createMatrixDi(self, matrixxy):
matrixxy.sort()
vectorY = []
index = 1
for values in matrixxy:
vectorY.append( [ values[1], index ])
index += 1
x = 0
matrix= []
while (x < len(vectorY)):
matrix.append( [(x+1), vectorY[x][1]] )
x += 1
return(matrix, len(vectorY))