2019-11-07 08:58:16 -05:00
|
|
|
class Matrix:
|
2014-03-18 05:34:18 +01:00
|
|
|
def __init__(self, s):
|
|
|
|
|
self.rows = [[int(n) for n in row.split()]
|
|
|
|
|
for row in s.split('\n')]
|
2018-02-17 04:03:08 +08:00
|
|
|
self.columns = [list(tup) for tup in zip(*self.rows)]
|
2014-03-18 05:34:18 +01:00
|
|
|
|
2018-02-17 04:03:08 +08:00
|
|
|
def row(self, index):
|
2019-01-14 10:22:45 -06:00
|
|
|
return self.rows[index - 1]
|
2018-02-17 04:03:08 +08:00
|
|
|
|
|
|
|
|
def column(self, index):
|
2019-01-14 10:22:45 -06:00
|
|
|
return self.columns[index - 1]
|