From the course: Programming Foundations: Beyond the Fundamentals

Unlock this course with a free trial

Join today to access over 25,600 courses taught by industry experts.

Creating more complex collections

Creating more complex collections

- Sometimes simply grouping data doesn't meet my organizing needs. For instance, say I've organized all my papers for a project into stacks, receipts, correspondence, and forms. Without a label, it can be hard to remember what's in which pile, and I certainly just can't stack it all up together without losing my organization. With papers, I can use a system like hanging file folders and I can indicate the category on the file folder tab. When I'm done with the box, I have all the documents grouped and labeled for easy access, but stored within a single project, like my papers, related data in my program sometimes needs a more complex approach to organization as well. Many programming languages support a rich collection type that lets you store related information but with a label for each item. In Python, the dictionary data type serves this function. To create a dictionary, I specify a variable name and close the value…

Contents