Files
python/exercises/matrix/example.py

12 lines
333 B
Python
Raw Normal View History

2014-03-18 05:34:18 +01:00
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)]
2014-03-18 05:34:18 +01:00
def row(self, index):
return self.rows[index]
def column(self, index):
return self.columns[index]