первую задачу решил

This commit is contained in:
2025-12-06 17:26:10 +03:00
parent f8f92b105d
commit 120fe2e2d6
3 changed files with 54 additions and 0 deletions

25
2025/day06/part1.py Normal file
View File

@@ -0,0 +1,25 @@
input = """123 328 51 64
45 64 387 23
6 98 215 314
* + * + """
with open("input.txt", "r") as file:
input = file.read()
# for row in input.splitlines():
# print(row)
# print("="*100)
numbers = [list(map(int, row.strip().split())) for row in input.splitlines()[:-1]]
operators = input.splitlines()[-1].strip().split()
result = [row for row in numbers[0]]
for row in numbers[1:]:
for index in range(len(result)):
element = row[index]
op = operators[index]
if op == "*":
result[index] *= element
elif op == "+":
result[index] += element
count = 0
for row in result:
count += row
print(result)
print(count)