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:
    elif columns < min:
    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 "- |",
                print board[(x,y)], "|"
        print ""

def test():
    print ">>Test<<"
    board[0,0] = "X"
    board[0,1] = "O"


Is there anyway to fix this so it prints like;
| X | O | - | - |

A new line is printed when you use "print" by itself.

# The below will actually display "Alpha\n"
print "Alpha"

# You can place a comma after the statement to not send the newline, but it will add a space
# The below will display: "Alpha Beta Gamma"
print "Alpha", "Beta", "Gamma"

# If you use string concatenation (plus sign) you can stop the space and the newline.
# The snippet below displays: "AlphaBetaGamma"
print "Alpha" + "Beta" + "Gamma"

That is *about* it. Hope it helps :)

Thanks I was missing a comma, works now