In Python, a multi-dimensional table like this can be implemented as a sequence of sequences. A table is a sequence of rows. Each row is a sequence of individual cells. This allows us to use mathematical-like notation. Where the mathematician might sayAi,j, in Python we can sayA[i][j]. In Python, we want the rowifrom table A, and columnjfrom that row.
This looks remarkably like thelistoftuples we discussed inthe section called “Lists of Tuples”.
2-Dimensional Metrix sample code:
MatrixUseful link:
http://www.linuxtopia.org/online_books/programming_books/python_programming/python_ch20s05.html
3-Dimensional Array Defination:
3-D array defination
网友评论