A matrix is represented as a list of lists, where each inner list is one row of the matrix. All the rows have the same length. Zero-based indexing is used throughout, so the first row is at index 0.
Write a function named get_column that accepts a matrix named mat and a
non-negative integer named col as arguments. It should return the column that
is at index col in the matrix mat, as a list. The elements of the returned
list must appear in row order: the element from row 0 first, then row 1, and so
on.
You may assume that col is a valid column index for mat.
You do not have to accept input from the user or print anything to the console. You just have to write the function definition.
Example
get_column([[1, 2, 3], [4, 5, 6]], 0) -> [1, 4]
Implement this function:
def get_column(mat, col):
Write the function only — the arguments are read for you and the return value is printed automatically.
Arguments arrive as one Python literal per line, in this order: mat, col.
Input
[[1, 2, 3], [4, 5, 6]]
0
Output
[1, 4]