Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- matrix = [[random.randint(-10, 10) for x in range(3)] for x in range(10)]
- print('Исходная матрица:', matrix)
- s = []
- for i in range(len(matrix)):
- s.append(sum(matrix[i]))
- print("Строка с наибольшей суммой:", matrix[s.index(max(s))], "Сумма элементов:", max(s),
- "\n Строка с наименьшей суммой:", matrix[s.index(min(s))], "Сумма элементов:", min(s))
- matrix = [[1 if x > 0 else 0 for x in i] for i in matrix]
- for i in range(len(matrix)):
- print(*[matrix[i][x] if x <= i else '' for x in range(len(matrix[i]))], '')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement