1 вариант
from random import randint
N = 3
M = 5
lst=[[randint(1, 9) for i in range(N)] for i in range(M)]
for i in lst:
print()
for j in i:
print (j, end=" ")
Объяснение:
2 вариант
import random
def main():
n = 3
m = 4
matrix = [[random.randint(0, 9) for _ in range(m)] for _ in range(n)]
print(*matrix, sep='\n')
if __name__ == '__main__':
main()
Думаю норм?
1 вариант
from random import randint
N = 3
M = 5
lst=[[randint(1, 9) for i in range(N)] for i in range(M)]
for i in lst:
print()
for j in i:
print (j, end=" ")
Объяснение:
2 вариант
import random
def main():
n = 3
m = 4
matrix = [[random.randint(0, 9) for _ in range(m)] for _ in range(n)]
print(*matrix, sep='\n')
if __name__ == '__main__':
main()
Думаю норм?
Объяснение:
from random import randint
N = 3
M = 5
lst=[[randint(1, 9) for i in range(N)] for i in range(M)]
for i in lst:
print()
for j in i:
print (j, end=" ")