Open this example in the interactive library
Source code
from collections import Counter
issued = Counter(['red', 'red', 'blue'])
returned = Counter(['red'])
print(list((issued - returned).elements()))
Sample output
['red', 'blue']

Remove one occurrence for every returned ticket using Python lists and dictionaries.
Open this example in the interactive library
from collections import Counter
issued = Counter(['red', 'red', 'blue'])
returned = Counter(['red'])
print(list((issued - returned).elements()))
['red', 'blue']