Accessing Values in a Two Dimensional Array
from array import *T = [[11, 12, 5, 2], [15, 6,10], [10, 8, 12, 5], [12,15,8,6]]
print(T[0])
print(T[1][2])
A = [[11, 12], [15, 6], [10, 8], [12,15], [11, 6], [32,6]]
print(A[0])
print(A[0][1])
print(A[3][1])
print(A[4][0])
print(A)
n=5
for i in range (0,n+1): # n --> n+1
print (A[i][0] ,'\t' , A[i][1])
15
11
[[11, 12], [15, 6], [10, 8], [12, 15], [11, 6], [32, 6]]
11 12
15 6
10 8
12 15
11 6
32 6
...Program finished with exit code 0
Press ENTER to exit console.
沒有留言:
張貼留言