I am interested in knowing how the keys of a dictionary would be searched if we wanted to check that a value 'x' would be a key in the dictionary. I understand that this would be done by doing something like this
if x in dictionary:
print 'yes'
How does Python search through the dictionary to find the key 'x'? Does it go element by element? Or does it simply check if an exception/error is thrown if indexing the dictionary by 'x'? What would be the complexity?