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.

沒有留言:

張貼留言

2024_09 作業3 以Node-Red 為主

 2024_09 作業3  (以Node-Red 為主  Arduino 可能需要配合修改 ) Arduino 可能需要修改的部分 1)mqtt broker  2) 主題Topic (發行 接收) 3) WIFI ssid , password const char br...