counts = { 'quincy' : 1 , 'mrugesh' : 42, 'beau': 100, '0': 10} print(counts.get('kris', 0))
The function get takes two arguments one is the key and the second one is the default value to return if the key is not in the dictionary. Here we are passing "kris" which is not present in the dictionary and hence the default value 0 is returned.