+ 1
How can i take 2*3 matrix as input?i have to make function of it?,
3 Answers
+ 15
input_matrix = []
while True:
row = input()
if row:
input_matrix.append(row)
else:
break
print(input_matrix)
# this works here at SL code playground
# but you must input a blank line at the end
# or the while loop never reaches "break"
+ 3
I think you want to take the single elements of the matrix as input?
m = [[input('0,0> '), input('0,1> '), input('0,2> ')], [input('1,0> '), input('1,1> '), input('1,2> ')]]
print(m)
# doesn't work in Sololearn, but in every console
+ 1
it shows invalid syntax for "]".