I have a list of tuples as below :
ls = [("red", "apple"), ("black", "grapes"),
("green", "apple"), ("yellow", "banana"),
("white", "litchi"), ("brown", "grapes")]
If you notice, I have both red and green "apple" as well as black and brown "grapes". So I want to remove any one tuple and retain the another one, the output should look like:
output = [("red", "apple"), ("black", "grapes"),
("yellow", "banana"), ("white", "litchi")]
so in the output (green apple) and (brown grapes) is removed.
Is there any way to achieve this? I tried many times but could not figure out. Please help.. :)