You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def create():
mas = []
rows = int(input(f'Введите количество чисел по горизонтали: '))
cols = int(input(f'Введите количество чисел по вертикали: '))
for i in range(rows):
row = []
for j in range(cols):
row.append(random.randint(1, 100))
mas.append(row)
return mas
def sum(mas_1, mas_2):
if (len(mas_1) != len(mas_2) and len(mas_1[0]) != len(mas_2[0])):
return None
result = []
for i in range(len(mas_1)):
row = []
for j in range(len(mas_2[0])):
row.append(mas_1[i][j] + mas_2[i][j])
result.append(row)
return result
def mas_list(mas):
for row in mas:
for item in row:
print(item, end=" ")
print()
import random
def create():
mas = []
rows = int(input(f'Введите количество чисел по горизонтали: '))
cols = int(input(f'Введите количество чисел по вертикали: '))
for i in range(rows):
row = []
for j in range(cols):
row.append(random.randint(1, 100))
mas.append(row)
return mas
def sum(mas_1, mas_2):
if (len(mas_1) != len(mas_2) and len(mas_1[0]) != len(mas_2[0])):
return None
result = []
for i in range(len(mas_1)):
row = []
for j in range(len(mas_2[0])):
row.append(mas_1[i][j] + mas_2[i][j])
result.append(row)
return result
def mas_list(mas):
for row in mas:
for item in row:
print(item, end=" ")
print()
mas_1 = create()
mas_list(mas_1)
mas_2 = create()
mas_list(mas_2)
mas_3 = sum(mas_1, mas_2)
print(f'Сумма массивов: ')
mas_list(mas_3)
The text was updated successfully, but these errors were encountered: