I want to read a square matrix like this from the console using python:
1 2 3
2 1 6
5 1 2
I tried using this:
matrix = [[int(input()) for x in range (n)] for y in range(n)]
But here each element can be given line by line and not like a matrix. We can also read it as a single line but how do I read it like above?