title: Remove Multiple Elements in a Python List Once
body: <p>(Using Python 3)</p>
  
  <p>Given this list named numList: [1,1,2,2,3,3,3,4].
  I want to remove exactly one instance of “1” and “3” from numList.
  In other words, I want a function that will turn numList into: [1,2,2,3,3,4].
  What function will let me remove an X number of elements from a Python list once per element I want to remove?
  (The elements I want to remove are guaranteed to exist in the list)</p>
  
  <p>For the sake of clarity, I will give more examples:</p>
  
  <p>[1,2,3,3,4]
  Remove 2 and 3
  [1,3,4]</p>
  
  <p>[3,3,3]
  Remove 3
  [3,3]</p>
  
  <p>[1,1,2,2,3,4,4,4,4]
  Remove 2, 3 and 4
  [1,1,2,4,4,4]</p>
  
  <p>I’ve tried doing this:</p>
  
  <p>numList=[1,2,2,3,3,4,4,4]</p>
  
  <p>remList = [2,3,4]</p>
  
  <p>for x in remList:</p>
  
  <pre><code> numList.remove(x)
  </code></pre>
  
  <p>This turns numList to [1,2,3,4,4] which is what I want. However, this has a complexity of:</p>
  
  <p>O((len(numList))^(len(remList)))</p>
  
  <p>This is a problem because remList and numList can have a length of 10^5. The program will take a long time to run. Is there a built-in function that does what I want faster?</p>
  
  <p>Also, I would prefer the optimum function which can do this job in terms of space and time because the program needs to run in less than a second and the size of the list is large.</p>