2018年12月25日 星期二

Python Accessing Values in a Two Dimensional Array

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.

沒有留言:

張貼留言

113 學年度第 1 學期 RFID應用課程 Arduino程式

113 學年度第 1 學期 RFID應用課程 Arduino程式 https://www.mediafire.com/file/zr0h0p3iosq12jw/MFRC522+(2).7z/file 內含修改過後的 MFRC522 程式庫 (原程式有錯誤) //定義MFRC522...