Ответ:
from random import randint
n, m=map(int, input('Введите размер матрицы :').split())
a=[[randint(1,20) for j in range(n)] for i in range(m)]
bmax=[0]*n
for i in range (0, m): print(a[i])
for j in range(0,n):
for i in range(0,m):
if bmax[j] < a[i][j]:
bmax[j] = a[i][j]
print('-----макс по столбцам', bmax, '--------')
z=max(bmax)
print('----------max=',z,'---------')
k=0
while k < len(bmax):
if bmax[k]==z:
for i in range (m):
del a[i][k]
del bmax[k]
k-=1
k+=1
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Ответ:
from random import randint
n, m=map(int, input('Введите размер матрицы :').split())
a=[[randint(1,20) for j in range(n)] for i in range(m)]
bmax=[0]*n
for i in range (0, m): print(a[i])
for j in range(0,n):
for i in range(0,m):
if bmax[j] < a[i][j]:
bmax[j] = a[i][j]
print('-----макс по столбцам', bmax, '--------')
z=max(bmax)
print('----------max=',z,'---------')
k=0
while k < len(bmax):
if bmax[k]==z:
for i in range (m):
del a[i][k]
del bmax[k]
k-=1
k+=1
for i in range (0, m): print(a[i])