Number of input data in the first line n Data dimension k on the second line I want to get n pieces of k-dimensional data from the third line What should I do?
For example,
4
2
5 10
10 20
6 8
15 11
I'd like to type it like this.
n = int(input())
k = int(input())
---- How do I code this part?----
I understood that I would like to receive a two-dimensional array of NxK
.
n = int(input())
k = int(input())
data = []
for i in range(n):
data.append([])
for j in range(k):
data[-1].append(input())
print(data)
I think it'd be good to do it like this
n = int(input())
k = int(input())
arr= []
for i in range(n):
arr.append(list(map(int,input().split())))
© 2024 OneMinuteCode. All rights reserved.