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.

沒有留言:

張貼留言

Messaging API作為替代方案

  LINE超好用功能要沒了!LINE Notify明年3月底終止服務,有什麼替代方案? LINE Notify將於2025年3月31日結束服務,官方建議改用Messaging API作為替代方案。 //CHANNEL_ACCESS_TOKEN = 'Messaging ...