Logical indexing with lists
<p>I have a program I'm looking through and with this section</p>

<pre><code>temp = [1,2,3,4,5,6]
temp[temp!=1]=0
print temp
</code></pre>

<p>Which if run gives the result:</p>

<pre><code>[1, 0, 3, 4, 5, 6]
</code></pre>

<p>I need help understanding what is going on in this code that leads to this result.</p>