Say, I wish to compute the difference of two lists C = A - B:
C = A - B
A = [1,2,3,4,5,6,7,8,9] B = [1,3,5,8,9] C = [2,4,6,7] #Result
Average time complexity for lookup (x in S) in a set is O(1) while the same for a list is O(n).
You can check the details at https://wiki.python.org/moin/TimeComplexity