title: Python - How to remove similar elements from a list?
body: <p>For example I have a list:</p>
  
  <pre><code>L = [1, 2, 2, 3, 1, 1, 6, 10, 1, 3]
  </code></pre>
  
  <p>And I want to remove all 1's from the list, so that I would get:</p>
  
  <pre><code>L = [2, 2, 3, 6, 10, 3]
  </code></pre>
  
  <p>I tried iterating over the list and then deleting the element if it equals the element I want to delete (1 in this case), but turns out you can't iterate and delete stuff from a list at the same time since it messes up the counting. The best thing I've come up with is just construct a new list L2 that doesn't contain any of the 1's and then put that into L, but is there a solution that only involves mutating L?</p>