-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.py
More file actions
37 lines (26 loc) · 939 Bytes
/
Copy pathtemplate.py
File metadata and controls
37 lines (26 loc) · 939 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import argparse, time
def part_one(f) -> int:
pass
def part_two(f) -> int:
pass
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("parts", nargs="*")
parser.add_argument("-t", "--test", action=argparse.BooleanOptionalAction)
args = parser.parse_args()
file_name = "input_test.txt" if args.test else "input.txt"
f = open(file_name)
run_pt_1 = not args.parts or "1" in args.parts
run_pt_2 = not args.parts or "2" in args.parts
if run_pt_1:
start = time.perf_counter()
pt_1_result = part_one(f)
elapsed = (time.perf_counter() - start) * 1000
print("Part One:", pt_1_result, "(Ran in", round(elapsed, 8), "ms)")
f.seek(0)
if run_pt_2:
start = time.perf_counter()
pt_2_result = part_two(f)
elapsed = (time.perf_counter() - start) * 1000
print("Part Two:", pt_2_result, "(Ran in", round(elapsed, 8), "ms)")
f.close()