title: Difference Between Two Lists with Duplicates in Python
body: <p>I have two lists that contain many of the same items, including duplicate items. I want to check which items in the first list are not in the second list. For example, I might have one list like this:</p>
  
  <pre><code>l1 = ['a', 'b', 'c', 'b', 'c']
  </code></pre>
  
  <p>and one list like this:</p>
  
  <pre><code>l2 = ['a', 'b', 'c', 'b']
  </code></pre>
  
  <p>Comparing these two lists I would want to return a third list like this:</p>
  
  <pre><code>l3 = ['c']
  </code></pre>
  
  <p>I am currently using some terrible code that I made a while ago that I'm fairly certain doesn't even work properly shown below.</p>
  
  <pre><code>def list_difference(l1,l2):
      for i in range(0, len(l1)):
          for j in range(0, len(l2)):
              if l1[i] == l1[j]:
                  l1[i] = 'damn'
                  l2[j] = 'damn'
      l3 = []
      for item in l1:
          if item!='damn':
              l3.append(item)
      return l3
  </code></pre>
  
  <p>How can I better accomplish this task?</p>