From the course: Programming Foundations: Data Structures (2023)

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

Multidimensional lists

Multidimensional lists

- In some cases, a regular list is not enough to store certain structures of data. For example, consider a seating chart in a classroom. You'll want to keep track of which student is in each row and column location within your class. To do that in Python, you can use a multi-dimensional list. These lists, also referred to as nested lists allow you to store multiple lists within a single list. This gives you the ability to track items in two and three dimensions. Let's move over to the computer and walk through how this works for a classroom seating arrangement in code. Here we have a two dimensional list that stores the seats the students are assigned in a given class. The outer list contains four inner lists where each inner list represents a row in a classroom. Each element in the inner list represents a student's name and the order of the names represents their seating arrangement, left to right. To access a specific…

Contents