Question: I have a matrice (list of list) say `a` and I want to normalize each "row" such that each element corresponds to the fraction of the corresponding row, i.e `[p/sum(p) for p in row]`.

I have the following code

```py

a_norm[:] = a
for i,row in enumerate(a_norm):
    b = [p/sum(row) for p in row]
    print(b)
    a_norm[i] = b

```

the rows being printed (print(b)) are completely fine but `a_norm` consists of purely zeros for some reason.

EDIT: Adding an example.

`a=np.array([[1,2,3], [20,22,13]])` should give `a_norm=[[0.16,0.33,0.5],[0.36,0.4,0.24]]`

Answer: 
try this one:

```
a_norm = [[i / sum(row) for i in row] for row in a]

```
Mistake you did in making list copy.
use `a_norm = a[:]` instead of `a_norm[:] = a`

You can try:

```
a_norm = a[:]
for i, row in enumerate(a_norm):
    b = [p/sum(row) for p in row]
    print(b)
    a_norm[i] = b
print(a_norm)

```