How to input the matrix | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to input the matrix

how to input line and colum

2nd Dec 2016, 1:56 PM
Sand Cold
Sand Cold - avatar
2 Answers
0
You can input an array by using multiple input statements for each column. Then you can store each row separately or use list of lists. Like rows = [] row = 4 for i in range(row): rows.append(input().split())
2nd Dec 2016, 2:40 PM
Aniruddh Dubey
Aniruddh Dubey - avatar
0
a = [] n = int(input('Input number of rows: ')) k = int(input('Input number of columns: ')) for i in range(k): a.append([]) for j in range(n): a[i].append(int(input()))
2nd Dec 2016, 5:32 PM
donkeyhot
donkeyhot - avatar