Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
Thread: TicTacToe Board In Python
12-12-2011, 09:23 PM #1
- Join Date
- Dec 2011
- Thanked 0 Times in 0 Posts
TicTacToe Board In Python
I need some help with this python code:
#If B is a board, printFriendly(B) renders the board B onto the screen as a tic #tac toe board with x's and o's in appropriate positions.
The following Python program prints the board ['x', 'e', 'x', 'x', 'o', 'o', 'o', 'e', 'x']:
pipe = '|'
space = ' '
This is what I know so far. I need to write the code for the aforementioned contract.
I have tried to fulfil the contract with this code:
board = [['x','x','o'],['','',''],['','x','o']]
for row in board:
print ("|%s|") % ('|'.join(row))
I continuously get error messages about incorrectly defining "board" as well as incorrect syntax. I have just started programming so I'm not sure what I'm doing wrong.
Any help is greatly appreciated.