remove duplicate value from list of tuples based on values from another list
You could do:
d1 = dict(l1)
d2 = dict(l2)
l3 = [(k, v) for k, v in d1.items() if k not in d2 or d2[k] < v]
l4 = [(k, v) for k, v in d2.items() if k not in d1 or d1[k] < v]
print(l3)
print(l4)
Output
[('two', 3), ('three', 3), ('four', 5)]
[('one', 3), ('ten', 3), ('twelve', 8)]
The idea is to use dictionaries for fast lookups of matching first values, if any, and then check if the corresponding second value is less to the one in the current list.