Day 18.2 test implementation
This commit is contained in:
parent
d95f7d6f4d
commit
f9bf55e461
1 changed files with 18 additions and 0 deletions
18
18-operationOrder/python/test.py
Normal file
18
18-operationOrder/python/test.py
Normal 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)
|
Loading…
Add table
Add a link
Reference in a new issue