Files
python/exercises/matrix/example.py
AnAccountForReportingBugs 2060fdc3ab Matrix: update tests to 1.1.0 (#1651)
Fixes #1645
2019-01-14 11:22:45 -05:00

12 lines
341 B
Python

class Matrix(object):
def __init__(self, s):
self.rows = [[int(n) for n in row.split()]
for row in s.split('\n')]
self.columns = [list(tup) for tup in zip(*self.rows)]
def row(self, index):
return self.rows[index - 1]
def column(self, index):
return self.columns[index - 1]