Skip to main content

Data Structures

Data structures are ways of organizing and storing data so that they can be accessed and modified efficiently. In Python, there are several built-in data structures, including lists, tuples, sets, and dictionaries. Each of these data structures has its own unique properties and use cases.

📄️ Lists

A key concept in programming is Lists (similar to the well known Array). A list is a data structure that allows you to store collection of data next to each other in memory. Then, you are able to access this data by using an index. Lists are also ordered, this means that all elements of a list will maintain their order (ex: [1, 2, 3] . The first value here will always be the first, it will not change order). They are also mutable and can be modified by adding, removing, or changing elements.

📄️ Tuples

Another important data structure in Python is the Tuple. A tuple is a data structure that allows you to store a collection of data next to each other in memory (just like a list)! Then, you are able to access this data by using an index. Tuples are also ordered, meaning that all elements of a tuple will maintain their order. However, tuples have a minor difference from lists: they are immutable, meaning that once you create a tuple, you cannot change its contents. This makes tuples a great choice for storing data that should not be modified.