def validSolution(board):
print([rank[i] for i in range(len(board[0])) for rank in board])
validSolution([[5, 3, 4, 6, 7, 8, 9, 1, 2],
[6, 7, 2, 1, 9, 5, 3, 4, 8],
[1, 9, 8, 3, 4, 2, 5, 6, 7],
[8, 5, 9, 7, 6, 1, 4, 2, 3],
[4, 2, 6, 8, 5, 3, 7, 9, 1],
[7, 1, 3, 9, 2, 4, 8, 5, 6],
[9, 6, 1, 5, 3, 7, 2, 8, 4],
[2, 8, 7, 4, 1, 9, 6, 3, 5],
[3, 4, 5, 2, 8, 6, 1, 7, 9]])
I want it to output every column separately in a form of list, like this:
[[5,6,1,8,4,7,9,2,3],[3,7,9,5,2,1,6,8,4], etc...]
however, i got this
[5, 6, 1, 8, 4, 7, 9, 2, 3, 3, 7, 9, 5, 2, 1, 6, 8, 4, 4, 2, 8, 9, 6, 3, 1, 7, 5, 6, 1, 3, 7, 8, 9, 5, 4, 2, 7, 9, 4, 6, 5, 2, 3, 1, 8, 8, 5, 2, 1, 3, 4, 7, 9, 6, 9, 3, 5, 4, 7, 8, 2, 6, 1, 1, 4, 6, 2, 9, 5, 8, 3, 7, 2, 8, 7, 3, 1, 6, 4, 5, 9]
simply put, it's different from what I had expected as it is not separated.
May I ask for a solution to get my desired output with list comprehension?