advent-of-code/2022/day01/part1.py

29 lines
423 B
Python
Raw Normal View History

2022-12-02 08:48:39 +01:00
"""
Part 1
"""
print("Hello World!")
file = open("input/input", "r")
MAXIMUM = 0
current = 0
for line in file.readlines():
line = line.strip()
if line == "":
# print("NEXT ELF")
if current >= MAXIMUM:
MAXIMUM = current
current = 0
else:
line = int(line)
current += line
# print(line)
if current >= MAXIMUM:
MAXIMUM = current
print(MAXIMUM)