...
Code Block | ||
---|---|---|
| ||
A = [[1, 2, 3], [4, 5, 6]] print("A =", A) print("A[1] =", A[1]) # 2nd row print("A[1][2] =", A[1][2]) # 3rd element of 2nd row print("A[0][-1] =", A[0][-1]) # Last element of 1st Row column = []; # Empty list for row in A: column.append(row[2]) # Adding the third print("3rd column =", column) |
The
...
script
...
above
...
will
...
result
...
in
...
the
...
following
...
output:
Code Block | ||
---|---|---|
| ||
A = [[1, 2, 3], [4, 5, 6]] A[1] = [4, 5, 6] A[1][2] = 6 A[0][-1] = 3 3rd column = [3, 6] |
...