This syntax is wrong:
imheight[i,j] = hij
imheight[j,i] = hij
Perhaps you meant this?
imheight[i][j] = hij
imheight[j][i] = hij
But then again, imheight
is a one-dimensional list, but you're assuming that it's a two-dimensional matrix. It will only work if you first initialize imheight
correctly:
imheight = [[0] * len(tables) for _ in range(len(tables))]