Basic code:
var1 = ['b', 'a', 'c', 'd']
var2 = ['c', 'a']
print(set(var1).difference(set(var2)))
Output:
{'b', 'd'}
Question
Is it possible to sort this output into alphabetical order? If so, how can I?
This is what I have tried:
print(set(var1).difference(set(var2)).sort())
But error shows up:
print(set(var1).difference(set(var2)).sort())
AttributeError: 'set' object has no attribute 'sort'