Nested Lists for Matrices or Tables in Python


Use lists within lists to store two-dimensional data.

Source Code

matrix = [
    [1, 2, 3],
    [4, 5, 6],
    [7, 8, 9]
]
print(matrix[1][2])  # Access row 1, column 2
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments