This repository has been archived on 2025-12-22. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
aoc2025/day6/main.py
2025-12-07 16:08:09 +01:00

24 lines
635 B
Python

with open("day6/input.txt") as file:
lines = file.readlines()
lines = [line.strip("\n").split() for line in lines]
for i in range(4):
lines[i] = [int(number) for number in lines[i]]
linesLen = len(lines)
lineLen = len(lines[0])
grandTotal = 0
for i in range(lineLen):
if(lines[4][i] == "*"):
grandTotal = grandTotal + (lines[0][i]*lines[1][i]*lines[2][i]*lines[3][i])
elif(lines[4][i] == "+"):
grandTotal = grandTotal + (lines[0][i]+lines[1][i]+lines[2][i]+lines[3][i])
else:
print("ohoh ein Fehler")
newGrandTotal = 0
# Part 2
print(f"Part 1: {grandTotal}\n\rPart 2: {newGrandTotal}")