Changing diagonal of matrix using an if- statement?
<p>I am trying to loop through a matrix to replace every number along the diagonal (top left to bottom right), with -5. I have read previous questions and answers and I see that you can use... <code>np.fill_diagonal(A, -5)</code> to the get the answer. However I am trying to use a loop with if statements. Can anyone help me get started? Here is my matrix.</p>

<pre><code> A = array([[1.2,3.4,10.3],[2,8,78],[45,-36,8]]) 
</code></pre>
