10/14 why not (residents[1:3])?


why doesnt it work

residents = {'Puffin' : 104, 'Sloth' : 105, 'Burmese Python' : 106}
print (residents[1:3])


Hi, @woouzujoo ,

Slices work on lists and strings, but not on dictionaries. The reason for this is that dictionaries are unordered, so there is no reasonable means of denoting a range of keys or values. While the keys in the dictionary in this exercise could be conceptualized as having an order, because they all happen be integers, dictionaries in general allow keys of many different types. So, if we had a particular dictionary that contained integers, tuples, and other types of keys, we would not be able to order them in a meaningful manner. That's why dictionaries are considered to be unordered.