From 8966ec3b190173c1e7d6f123cd484284145dad90 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Sat, 30 Sep 2017 09:13:08 -0700 Subject: [PATCH] Move format to __str__ and implement __repr__ --- tictactoe.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tictactoe.py b/tictactoe.py index 894765b..4362db6 100644 --- a/tictactoe.py +++ b/tictactoe.py @@ -18,7 +18,10 @@ class Board: # Process the board into an array. self.board = string.lower() - def format(self): + def __repr__(self): + return "".format(self.board) + + def __str__(self): out = '' board_len = len(self.board) for x in range(board_len): @@ -37,4 +40,4 @@ def hello(): except ValueError: abort(400) - return (board.format(), 200, {'Content-type': 'text/plain'}) + return (str(board), 200, {'Content-type': 'text/plain'})