Looping copied list and deleting from original list deletes from copied list
<p>The snippet of code that's messing up:</p>

<pre><code>equ2 = ['+', '10', '+', '2', '-', '2', '+', '4']
flag4 = [ ]

for k in equ2[:]:
    if equ2[equ2.index(k)-1] == '+':
        del(equ2[equ2.index(k)])
        flag4.append('-' + k)
    elif equ2[equ2.index(k)-1] == '-':
        del(equ2[equ2.index(k)])
        flag4.append('+' + k)
print flag4
</code></pre>

<p>*Edit: I messed up the variables, sorry about that :x</p>

<p>*Edit2: Sorry again D: jedwards, that is the output I'm getting, I got the other output by deleting from the copied list</p>

<p>Output I'm getting:</p>

<pre><code>['-10', '-2', '--', '-2', '-4']
</code></pre>

<p>Output I want:</p>

<pre><code>['-10', '-2', '+'2, '-4']
</code></pre>

<p>I figured out that when it got to the '-', it checks the original list (now modified to + - 2 + 4), and sees that the item before the '-' is a '+', so it appends '--', then checks the original list again (now + 2 + 4) and sees the '+' before the 2, so it appends '-2' (fixes itself sorta after that). Is it checking the original list the whole time?</p>
