Day 18.2 test implementation

This commit is contained in:
akp 2020-12-19 10:37:45 +00:00
parent d95f7d6f4d
commit f9bf55e461
No known key found for this signature in database
GPG key ID: D3E7EAA31B39637E

View file

@ -0,0 +1,18 @@
# This file is a proof of concept for using the implementation in part one to complete part two
# after added extra brackets to evert expression.
import partOne
instr = open("../input.txt").read()
expressions = instr.strip().split("\n")
expressions = [
partOne.parse_expression(list(("( " + x.replace("*", ") * (") + " )").replace(" ", "")))[0] for x in instr.strip().split("\n")
]
sigma = 0
for expression in expressions:
sigma += partOne.calculate(expression)
print(sigma)