x - кол-во строк, y - кол-во столбцов
Ввод поэлементно:
x, y = map(int, input().split())
Matrix = [[int(input()) for _ in range(y)] for _ in range(x)]
print(Matrix)
Ввод построчно:
x = int(input())
Matrix = [list(map(int, input().split())) for _ in range(x)]
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
x - кол-во строк, y - кол-во столбцов
Ввод поэлементно:
x, y = map(int, input().split())
Matrix = [[int(input()) for _ in range(y)] for _ in range(x)]
print(Matrix)
Ввод построчно:
x = int(input())
Matrix = [list(map(int, input().split())) for _ in range(x)]
print(Matrix)