-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.py
36 lines (24 loc) · 869 Bytes
/
template.py
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
import argparse
import itertools
import os
import re
from collections import defaultdict, Counter
from pprint import pprint
def part1(input_file):
with open(input_file) as f:
lines = [x.strip() for x in f.read().strip().split("\n")]
def part2(input_file):
with open(input_file) as f:
lines = [x.strip() for x in f.read().strip().split("\n")]
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("part", choices=["1", "2"], help="Which part you want to run, the first part or the second part")
parser.add_argument("--sample", action="store_true", help="Do you want to use the sample input")
args = parser.parse_args()
input_file = "input.txt"
if args.sample:
input_file = "example.txt"
if args.part == "1":
part1(input_file)
else:
part2(input_file)