Added 2021 (python)
This commit is contained in:
19
2021/00_template/prog.py
Normal file
19
2021/00_template/prog.py
Normal file
@ -0,0 +1,19 @@
|
||||
VERBOSE = True
|
||||
def verbose(s = "", *args, **kwargs):
|
||||
if VERBOSE:
|
||||
print(s, *args, **kwargs)
|
||||
|
||||
def get_input(sample = False, part = 1):
|
||||
with open(f'sample_p{part}' if sample else 'input', 'r') as f:
|
||||
return [int(line.strip()) for line in f.readlines()]
|
||||
|
||||
|
||||
def result(inp, part = 1):
|
||||
res = 0;
|
||||
|
||||
return res
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
VERBOSE = False
|
||||
print(result(get_input(), part = 1))
|
10
2021/00_template/test.py
Normal file
10
2021/00_template/test.py
Normal file
@ -0,0 +1,10 @@
|
||||
from prog import *
|
||||
import unittest
|
||||
|
||||
class Tests(unittest.TestCase):
|
||||
def test_part1(self):
|
||||
self.assertEqual(result(get_input(sample = True)), 7)
|
||||
|
||||
# def test_part2(self):
|
||||
# self.assertEqual(result(get_input(sample = True), part = 2), 5)
|
||||
|
Reference in New Issue
Block a user