我在打印具有视觉吸引力的庄园中的列表时遇到了麻烦。该列表的一个例子是
[["-", "-", "-", "-"],["-", "-", "-", "-"],["-", "-", "-", "-"]]
Run Code Online (Sandbox Code Playgroud)
(字符不一定都相同),但我需要在不使用除print、range、len、insert、append、之外的任何函数的情况下打印它pop,并且我不能使用任何字典或映射,也不能导入任何库或使用任何列表理解。我反过来想要:
- - - -
- - - -
- - - -
Run Code Online (Sandbox Code Playgroud)
我试过:
def print_board(board):
for i in board:
row = board[i]
for r in row:
print(*row[r], "\n")
Run Code Online (Sandbox Code Playgroud)