Is the in operator\'s speed in python proportional to the length of the iterable?
in
So,
len(x) #10 if(a in x): #lets say this takes time A
A summary for in:
list - Average: O(n) set/dict - Average: O(1), Worst: O(n)
See this for more details.