
A quick guide to Python's Dictionary
A dictionary is one of the most significant data structures in Python; it is literally a dictionary, mutable, not a sequence type, but it can be adapted for sequence processing. How do we make a dictionary? empty_dictionary = {} dictionary = {"man": "woman", "boy": "girl", "tall": "short", "giant": "dwarf"} staff_address = {"Jibbs": "London", "KB": "Milton Keynes", "MJ": "Stoke-on-Trent"} phone_numbers = {"Jibbs": 473747383, "KB": 483943929, 'MJ': 39394930} staff_id = {34: "JB", 23: "KB", 21: "MJ"} indexes = {23: 43, 43: 75, 38: 87} Using the above examples: The first one is an empty dictionary, constructed with an empty pair of curly braces. The second and third ones use keys and values that are both strings. In the fourth one, the keys are strings while the values are integers. In the fifth example, the key is an integer while the values are strings. In the last example, both keys and values are integers. I used the last two examples to establish that reverse layout (key -> numbers,
Continue reading on Dev.to Python
Opens in a new tab




