Variable referenced instead of copied
<p>When I run the code below it removes <code>deleted_partner</code> from <code>B</code>. But as it removes it from <code>B</code> it also removes it from <code>A</code>. So that when I try to remove it from <code>A</code> the program crashes. What is the problem?</p>

<pre><code>for deleted_partner in self.list_of_trading_partners: 
    B = A[:]
    print("t", deleted_partner)
    print(B[self.ID].list_of_trading_partners)
    B[self.ID].list_of_trading_partners.remove(deleted_partner)
    Round_neo_classic(B)
    Round_costs(B)
    if B[self.ID].final_good &gt; reference_value:
        print("d", deleted_partner)
        print(A[self.ID].list_of_trading_partners)
        A[self.ID].list_of_trading_partners.remove(deleted_partner)
</code></pre>

<p>Output:</p>

<pre><code>('t', 1)
[1, 2, 3, 4]
('d', 1)
[2, 3, 4]
</code></pre>
