I&C SCI 31 Chapter Notes - Chapter 6: Key 2, Subset, Symmetric Difference
Document Summary
Want to access list items using user-defined indexes such as strings. A dictionary is a container that stores items that are accessible using user-specified indexes. First part are indexes, after colon are values. The dictionary employee differs from a list in that an item in a dictionary is accessed using a user- specified index rather than the index representing the item"s position in the container. The python dictionary type, denoted dict, is a container type, like str and list. The general format of the expression that evaluates to a dictionary object is: {:, :,, ,} The key and value are both objects. Key is the index that is used to access the value. 100-01-0010" is the key, [ hans", castorp"] is the value. The pairs are separated by commas and enclosed curly braces. The key and value are separated by a colon.