0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

paizaラーニング「二次元配列の入力 4 Python3編」

Posted at

私の解答

N,M = map(int,input().split())
A = [[0] * M for _ in range(N)]
for i in range(N):
    A[i] = list(map(int, input().split()))
for i in range(N):
    print(*A[i])

@WolfMoon先生の解答例を参考にしました。

解答例

values = input().split()
N = int(values[0])
M = int(values[1])

A = [[0] * M for _ in range(N)]
for i in range(N):
    values = input().split()
    for j in range(M):
        A[i][j] = int(values[j])

for i in range(N):
    for j in range(M):
        print(A[i][j], end="")

        if j < M - 1:
            print(end=" ")
        else:
            print()
0
0
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?