Below is my script, which basically creates a zero matrix of 12x8 filled with 0. Then I want to fill it in, one by one. So lets say column 2 row 0 needs to be 5. How do I do that? The example below shows how I did it and the wrong (for my needs) output:
list_MatrixRow = []
list_Matrix = [] #Not to be confused by what the book calls, optimal alignment score matrixint_NumbOfColumns = 12
int_NumbOfRows = 8for i in range (0, int_NumbOfColumns): # Puts Zeros across the first Rowlist_AlignMatrixRow.append(0)
for i in range (0, int_NumbOfRows):list_AlignMatrix.append(list_AlignMatrixRow)
#add the list in another list to make matrix of Zeros
#-------------------THE ACTUAL PROBLEMATIC PART; ABOVE IS FINE(It Works)------------list_AlignMatrix[2][0] = 5
# This is what logically makes sense but here is the output
# which happens but I don't want (there should be all 0s and
# only one 5 on the cell [2][0]):[5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]