In [1]:
d = {'key1': 'val1', 'key2': 'val2', 'key3': 'val3'}

In [2]:
print('key1' in d)


True

In [3]:
print('val1' in d)


False

In [4]:
print('key4' not in d)


True

In [5]:
print(d['key1'])


val1

In [6]:
# print(d['key4'])
# KeyError: 'key4'

In [7]:
print(d.get('key4'))


None

In [8]:
print('val1' in d.values())


True

In [9]:
print('val4' not in d.values())


True

In [10]:
print(('key1', 'val1') in d.items())


True

In [11]:
print(('key1', 'val2') in d.items())


False

In [12]:
print(('key1', 'val2') not in d.items())


True