advent-of-code/2022/day1.py

8 lines
195 B
Python
Raw Normal View History

2022-12-03 10:42:09 +00:00
import sys
2022-12-01 18:10:40 +00:00
2023-01-06 12:48:18 +00:00
blocks = sys.stdin.read().split("\n\n")
values = sorted(sum(map(int, block.split())) for block in blocks)
2022-12-01 18:10:40 +00:00
2023-01-06 12:48:18 +00:00
print(f"answer 1 is {values[-1]}")
print(f"answer 2 is {sum(values[-3:])}")