Hi,
I have a problem with my matrix program. i created and initialized my matrix now i have to file the matrix with values of corr.
i want it to look like this
[1, 0.1, 0.2, 0.3]
[0, 1, 0.4, 0.5]
[0, 0, 1, 0.6]
[0, 0, 0, 1]
file =
corr =
############### initializing the matrix###################
def make_list(size):
mylist = []
for i in range(size):
mylist.append(0)
return mylist
mx = []
def make_matrix(rows,cols):
for i in range(rows):
mx.append(make_list(cols))
return mx
matrix = make_matrix(4, 4)
print(matrix)
##################### filling the matrix###################
for x in range(len(file)):
for y in range(x, len(file)):
if x!= y:
matrix[x][y] = corr(file[x], file[y]) # i want the value of corr here but i dont know what is the syntax
else:
matrix[x][y] = 1
################## printing the matrix #####################
for i in range(len(matrix)):
print matrix
for this program i am getting an error like this
File "symm_matrix.py", line 32, in <module>
matrix[x][y] = corr(file[x], file[y])
TypeError: 'list' object is not callable
please help....