0

My teacher gave this snippet for Accepting input from user and creating a matrix using list.

I am not able to understand the row and column part here. can a sample matrix be generated so that I can understand how the matrix will look? r,c=3,2 x=[] for i in range(r): x.append([0]*c) for i1 in range(r): for i2 in range(c): x[i1][i2]=int(input()) print()

7th Nov 2018, 3:42 PM
Mara
2 Respostas
+ 7
[[x00, x01], ← columns = 2 [x10, x11], [x20, x21]] ↑rows = 3
7th Nov 2018, 4:27 PM
Flandre Scarlet
Flandre Scarlet - avatar
+ 2
You can use print(x) to see what values are saved in the matrix.
7th Nov 2018, 4:00 PM
Mirko Klotzsche
Mirko Klotzsche - avatar