# how to assign element in a list of list ?

defined at first my 0 matrix like this

t1=[0,0,0,0,0]

for k1 in range(0,5): #

mtri1.append(t1)

which means that all the sub list are link

to correct this just use this to have independant list

for k1 in range(0,5):

mtri1.append(list(t1))

then the sub list will be unlink

%%%%%%%%%%%%%%%

l’v predefined a list of lists to representant a matrix
like
mat = [ [ 0,0,0,0,0]
[ 0,0,0,0,0]
[ 0,0,0,0,0]
[ 0,0,0,0,0]
[ 0,0,0,0,0]
]

now trying to asssing values to each item in this matrix !
here a loop only ounce

for k1 in range(0,1): # Transfering data to make tri diagonal matrix

mtri1[k1][k1]=mtri1[k1][k1]+rligne[k1]+rl[k1]

but does this which is way too much

0 = [135.528064, 0.0, 0.0, 0.0, 0.0]
1 = [135.528064, 0.0, 0.0, 0.0, 0.0]
2 = [135.528064, 0.0, 0.0, 0.0, 0.0]
3 = [135.528064, 0.0, 0.0, 0.0, 0.0]
4 = [135.528064, 0.0, 0.0, 0.0, 0.0]

the problen is that it is assigning values to all the first element on all rows
can someone explain how not to assign to all first values at same time ?
and why it is doing this ?

thanks for any help