Data Structures

Dictionaries (Key-Value Pairs)

Introduction: In Python, a dictionary is a versatile and powerful data structure used to store information as key-value pairs. Unlike lists and tuples that use an index to access elements, dictionaries allow you to access values using unique keys. This makes them an excellent choice for storing and organising data where each piece of information …

Dictionaries (Key-Value Pairs) Read More »

Tuples (Immutable Lists)

Introduction: In Python, a tuple is a type of data structure that is similar to a list, but with one key difference—tuples are immutable. This means that once a tuple is created, you cannot change, add, or remove its elements, whilst the program is running. Tuples are useful when you need to store a collection …

Tuples (Immutable Lists) Read More »

2 Dimensional Lists

Introduction: In Python, we often need to work with more complex structures than simple lists. One such structure is a 2D list, also called a matrix. A 2D list is essentially a list of lists, allowing you to organise data in rows and columns, much like a table or spreadsheet. In other programming languages, a …

2 Dimensional Lists Read More »

Scroll to Top