if accessing dictionary values by key is similar to list by refering to indexes, then how come i cant just print the sloth and burmese python by print residents[‘sloth’: ]
the syntax is similar, except we use a key instead of an index. That is pretty much where the similarity ends.
Dictionaries are unordered by nature, where list are ordered. So in dictionaries, there is no way we can use slices, given we won’t know the order of the dictionary, as such, there is no slice for dictionary in the python language
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.