Table of Content
Today I will show a little trick that creates a new list based on the difference of two lists, the code as follow:
1 2 3 4 5 6 7 |
a = ['Nice', 'to', 'see', 'u'] b = ['Nice', 'to', 'see', 'u', 'too'] diff = list(set(b).symmetric_difference(set(a))) print(f"difference here: {diff}") # Output: difference here: ['too'] |