So I am working on my first terminal game in python as practice and I just can't get the output in the terminal to follow what I want.
Instance Variables:
board = []
board_size = 10
alphabet = "ABCDEFGHIJ"
Code snippet:
def create_board():
for i in range(0, board_size):
board.append(["."] * board_size)
print_board(board)
def print_board(board):
count = 0
while count < 10:
for i in board:
board_layout = alphabet[count] + " " + " ".join(i)
continue
count += 1
print(board_layout)
def main():
create_board()
Terminal Output:
J . . . . . . . . . .
J . . . . . . . . . .
J . . . . . . . . . .
J . . . . . . . . . .
J . . . . . . . . . .
J . . . . . . . . . .
J . . . . . . . . . .
J . . . . . . . . . .
J . . . . . . . . . .
J . . . . . . . . . .
J . . . . . . . . . .
The desired output should be A - J and with the dots at each letter. Please let me know what I should try.
Other attemps I've tried:
for letter in alphabet:
for i in board:
board_layout = letter + " " + " ".join(i)
continue
print(board_layout)
for j in range(len(alphabet)):
for i in board:
board_layout = alphabet[j] + " " + " ".join(i)
print(board_layout)
I've also tried switching the order of the for loops with no success.