re-numbering list members in python : <p>How can re-numbering list members respectively from zero to n in Python ?</p>

<p>for example :</p>

<pre><code>In : [4, 10, 12, 40, 4, 12, 20, 21]

Out : [0, 1, 2, 3, 0, 2, 4, 5]
</code></pre>
