I have managed to create a custom sized grid which prints correctly but when I try and print X or 0 a new line is started. Please see the "test" result below.
def createBoard():
global rows,columns,board
rows = input("How many rows (more than 4)? ")
columns = input("How many columns (more than 4)? ")
board = {}
min = 4
if rows < min:
createboard()
elif columns < min:
createboard()
for x in range(rows):
for y in range(columns):
board[(x,y)] = "-"
def printBoard():
for x in range(rows):
print "|",
for y in range(columns):
if board[(x,y)] == "-":
print "- |",
else:
print board[(x,y)], "|"
print ""
def test():
print
print ">>Test<<"
board[0,0] = "X"
board[0,1] = "O"
printBoard()
createBoard()
printBoard()
test()
Is there anyway to fix this so it prints like;
| X | O | - | - |