accept input file as cmdline argument

This commit is contained in:
2025-01-04 15:38:12 +01:00
parent 89b6b5e107
commit 87871aed4d
13 changed files with 41 additions and 19 deletions

View File

@ -23,4 +23,6 @@ def main(infile):
print(f"Part 2, {res}")
if __name__ == "__main__":
main("input.txt")
import sys
infile = sys.argv[1] if len(sys.argv) > 1 else "example.txt"
main(infile)

View File

@ -31,4 +31,4 @@ def rotate(l):
for j in range(256):
numbers = rotate(numbers)
numbers[6] += numbers[8]
print(f'DAY {j+1} AMOUNT OF FISH: {sum(numbers)}')
print(f'DAY {j+1} AMOUNT OF FISH: {sum(numbers)}')