I have a list of strings, for example:
myList = ["paper", "Plastic", "aluminum", "PAPer", "tin", "glass", "tin", "PAPER", "Polypropylene Plastic"]
I want this result (and this is the only acceptable result):
myList = ["paper", "Plastic", "aluminum", "tin", "glass", "Polypropylene Plastic"]
Note that if element ( "Polypropylene Plastic"
) contains another element ( "Plastic"
), I would still like to keep both elements. Thus, the cases may be different, but this element must be alphabetic so that it can be removed.
The original list order must be kept. All duplicates after the first instance of this item must be deleted. The original case of this first instance must be preserved, as well as the original cases of all non-duplicated elements.
I searched and found only questions that relate to one or the other problem, and not both.