Jan-11-2022, 10:37 AM
I tried disecting it but is not taking me far since eventhough it is returning the difference, the result is not "filling back" to what list it belongs, which should return
['pear', [-1, 2, 3]]
['pear', [-1, 2, 3]]
list1 = [['orange', [1, 2, 3]]] list2 = [['apple', [1, 2, 3]], ['banana', [1, 2, 3]], ['pear', [-1, 2, 3]], ['kiwi', [1, -2, 3]]] S = set(tuple(x[1]) for x in list1) a = [x[1][0] for x in list1] b = [x[1][0] for x in list2] z = [x for x in b if x not in a] print(z)