Replace all negative values in a list
<p>I'm trying to solve this problem on codewars and I'm completely stumped:</p>

<pre><code>y = [-1, -1, 2, 8, -1, 4]
z = [1,3,5]
#to create [1,3,2,8,5,4]
</code></pre>

<p>How would I do this?</p>

<p>I tried to do:</p>

<pre><code>for e in range(len(y)):
    try:
        if y[e] &lt; 0:
            y[e] = z[e]
    except:
        pass
</code></pre>

<p>But this would only work if the negatives correspond to what is in z.</p>

<p>One-liner. Emulate queue behavior using <code>pop()</code>. (<em>Note this consumes</em> <code>z</code>)</p>

<pre><code>&gt;&gt;&gt; print([num if num &gt; 0 else z.pop(0) for num in y])
[1, 3, 2, 8, 5, 4]
</code></pre>

python python-3.x