I have this code wrote in Python that is for inputting a matrix:
matrix = []
while True:
line = input()
if not line: break
values = line.split()
row = [int(value) for value in values]
matrix.append(row)
For example,a resulting matrix would be
[[9, 2, 4],
[7, 8, 0]]
I would like to know if there's any way to sort the lines and columns of it? For example, sorting the first line would result in [2, 4, 9]
and sorting the first column would result [7, 9]
.