I am trying to print a Tic-Tac-Toe board in the terminal, and give the user an option to choose how big the board should be. This is my code:
sq = [[" ", "|"],
[" ", "1", " ", "|",],
[" ", "|"],
["-------","|"]]
def square(board):
for row in board:
for slot in row:
print(slot, end="")
print()
number = int(input("How many squares do you want to board to be?\n"))
for x in range(number):
square(sq)
The problem is that they don't print on one line. I want to print the rows and then columns. I tried adding end=""
in the "for loop" but that didn't help.
Could somebody please explain to me what i need to change in my code in order to be able to print to the same row?