Please advise what is the correct way to verify if key x is stored in a dictionary dict. and if it is, set a value check to True and otherwise it will be set to False.
check = True
try :
y = d.x
except KeyError as e
check = False
Or is it the right way to do one the following?
check = dict.contains(x)check = dict.has_key(x)check = x in dictcheck = x.is_elem(dict)