mirror of
https://github.com/thib8956/advent-of-code.git
synced 2026-11-06 10:02:27 +00:00
chore: create new project structure and aoc.py runner script
This commit is contained in:
1 parent
f76375d835
commit
e2964c6c36
91 files changed
+177
-113
No files matched your search
@@ -0,0 +1,14 @@
|
||||
def main(content):
|
||||
inventories = [x.rstrip().split("\n") for x in content.split("\n\n")]
|
||||
calories = sorted((sum(int(y) for y in x) for x in inventories), reverse=True)
|
||||
print("Part 1: ", calories[0])
|
||||
print("Part 2: ", sum(calories[:3]))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
infile = sys.argv[1]
|
||||
with open(infile) as f:
|
||||
content = f.read()
|
||||
main(content)
|
||||
|
||||
Reference in new issue
Block a user