The complexity of len() with regards to sets and lists is equally O(1). How come it takes more time to process sets?
len()
~$ python -m timeit \"a=[1,2,3,
Remove the len(a) statement. The result is pretty much the same. A set needs to be hashed to retain only distinct items so it's slower.
len(a)