117
Программа листингі
import random
random.seed(None)
row = int(input("Input number of rows: "))
column = int(input("Input number of columns: "))
my_list = [[0 for col in range(column)] for r in
range(row)]
sum_column = [0 for col in range(column)]
product_row = [1 for row in range(row)]
for i in range(row):
for j in range(column):
my_list[i][j] = random.randint(0,50)
print (my_list)
for i in range(column):
for j in range(row):
sum_column[i] += my_list[j][i]
for i in range(row):
for j in range(column):
product_row[i] *= my_list[i][j]
print("Sum of column elements: ", sum_column)
print("Product of row elements: ", product_row)
Достарыңызбен бөлісу: