Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Les13_1 #26

Open
kostyria opened this issue Mar 30, 2023 · 0 comments
Open

Les13_1 #26

kostyria opened this issue Mar 30, 2023 · 0 comments

Comments

@kostyria
Copy link
Owner

kostyria commented Mar 30, 2023

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)

@kostyria kostyria changed the title Les_13_1 Les13_1 Mar 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant