Skip to content

Instantly share code, notes, and snippets.

@mekhami
Created February 4, 2016 19:06
Show Gist options
  • Select an option

  • Save mekhami/7e2da12fce078f63324f to your computer and use it in GitHub Desktop.

Select an option

Save mekhami/7e2da12fce078f63324f to your computer and use it in GitHub Desktop.
class Matrix(object):
def __init__(self, width, height):
self.width = width
self.height = height
self.matrix = []
for x in range(self.height):
self.matrix.append(['.'*self.width])
def __str__(self):
rows = [x for x in self.matrix]
return '\n'.join([''.join([x for x in rows])])
@mekhami
Copy link
Copy Markdown
Author

mekhami commented Feb 4, 2016

Traceback (most recent call last):
File "gameoflife.py", line 26, in
main_loop()
File "gameoflife.py", line 23, in main_loop
print(grid)
File "gameoflife.py", line 14, in str
return '\n'.join([''.join([x for x in rows])])
TypeError: sequence item 0: expected string, list found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment