Why is for loop iterating over (seemingly) empty list?
<p>I'm a beginner programmer, I decided to write a simple program getting prime factors out of a number and then printing them, but I'm having trouble in printing the final result. Here's the code:</p>

<pre><code>n = int(raw_input("Number?: "))
m = n
k = 2
czynniki = []       

while(m != 1):
    if m%k == 0:
        czynniki.append(k)
        print m, "\t", '|', k
        m = m/k
    else:
        k+=1
print m

print n, ' = ',
for czynnik in czynniki:
    if czynniki.count(czynnik)&gt;1:
        print czynnik, '^', czynniki.count(czynnik), ' *',
        czynniki = filter(lambda x: x!=czynnik, czynniki)
    else:
        print czynnik, ' *',
</code></pre>

<p>Everything is okay until the very end. For example I'd like it to print "1025 = 5^2 * 41" when 1025 is inputed, but instead it will print "1025 = 5^2 * 5 * 41", as if filter function had no impact at all. Where's the bug?</p>
