The study of programming, beyond the very basics, also involves the study of data structures. Data structures in computing are the tools we use to store and process data. There are many types of data structures, some are classic that were developed decades ago while other, newer, data structures are also in development as well.
Concept: Data Structures
A collection of data values, their relationships, and operations that can be performed on those data values. There are many different types of data structures in programming and various programming languages support some or all of them.
At this early stage of learning programming, the closest concepts you have learned to a data structure are
data types and
variables. These introduce the ideas of storing data in memory for use in our programs. The first
data structures beyond these two that we will explore are
lists and
dictionaries.
Lists in Python are ordered collections of items which can be of any type. Lists are mutable, meaning their contents can be changed after they are created. They can be thought of as dynamic arrays, but with the added benefit of being able to hold different types of data.
Dictionaries in Python are unordered collections of items. Each item in a dictionary has a key/value pair. Dictionaries are optimized to retrieve values when the key is known. They are mutable, which means they can be changed after they are created.
We will explore lists and dictionaries on the following pages.