Made a python version of puzzle 1

I'm going to use a different language per puzzle now.
This commit is contained in:
2023-10-17 14:13:15 +01:00
parent d3ed2f503e
commit 480c0f61b4

8
2022/puzzle-1.py Normal file
View File

@@ -0,0 +1,8 @@
inp = None
with open('1-input', 'r') as fp:
inp = fp.read()
sums = sorted([sum([int(entity) for entity in entity_str.split("\n") if entity != '']) for entity_str in inp.split("\n\n")])
print(f"round 1: {sums[-1]}")
print(f"round 2: {sums[-1]} {sums[-2]}, {sums[-3]}, {sum(sums[-3:])}")