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 - Python Tutorial
From the course: Programming Foundations: Data Structures (2023)
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
-
-
-
-
What is an array?3m 31s
-
(Locked)
Create a list in Python2m 27s
-
(Locked)
Retrieve data from a list in Python4m 26s
-
(Locked)
Mutate a list in Python2m 57s
-
(Locked)
Multidimensional lists7m 15s
-
(Locked)
Tuples in Python2m 45s
-
(Locked)
Search array-like structures4m 47s
-
(Locked)
Sort array-like structures5m 1s
-
(Locked)
Challenge: Find the second smallest item1m 35s
-
(Locked)
Solution: Find the second smallest item4m 26s
-
(Locked)
When to use array-like structures1m 15s
-
-
-
-
-
-
-