Python ProgrammingPython Programming

How to get unique collection of list items in python?

The set() method commonly used to get a unique collection of items.
list1 = ["Canada", "Japan", "Canada", "Germany", "Japan", "Italy"]
list2 = ["Germany", "France", "Poland", "Italy", "India", "London"]
 
sub1 = list(set(list1) - set(list2))
print(sub1)
 
sub2 = list(set(list2) - set(list1))
print(sub2)
Output
['Canada', 'Japan']
['India', 'France', 'Poland', 'London']