Lesson 12. Data Structures Part III: Dictionaries
Last updated
Last updated
Dictionaries are a way to store key value pairs.
In business analytics, keys are used to uniquely identify values. In databases, keys can be used to identify an entire record consisting of several values. However, we frequently just want to identify a single atomic value. For this, we can use dictionaries.
Dictionaries are created by passing in data in key value pairs separated by a colon. Each key value pair is then separated from the next key value pair by a comma. The entire set of key value pairs are surrounded by braces.
Example #1 Creating A Dictionary
Example #2 Adding A New Key Value Pair
Example #3 Accessing A Value In A Dictionary
Don't copy and past. Type the code yourself!