import random
array = [[random.randint(7, 20) for j in range(5)] for i in range(4)]
print("Масив:")
for i in range(4):
for j in range(5):
print(array[i][j], end="\t")
print()
row_sum = sum(array[i])
print(f"Сума елементів рядка {i+1}: {row_sum}")
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
import random
array = [[random.randint(7, 20) for j in range(5)] for i in range(4)]
print("Масив:")
for i in range(4):
for j in range(5):
print(array[i][j], end="\t")
print()
for i in range(4):
row_sum = sum(array[i])
print(f"Сума елементів рядка {i+1}: {row_sum}")