AdventOfCode/2015/08/solution.py

45 lines
935 B
Python

#!/bin/python3
import sys,re,ast,json
from pprint import pprint
sys.path.insert(0, '../../')
from fred import list2int,get_re,nprint,lprint,loadFile
input_f = 'input'
part = 2
#########################################
# #
# Part 1 #
# #
#########################################
if part == 1:
instructions = loadFile(input_f)
total = 0
for i in instructions:
total += (len(i)-len(ast.literal_eval(i)))
print(total)
#########################################
# #
# Part 2 #
# #
#########################################
if part == 2:
instructions = loadFile(input_f)
total = 0
for i in instructions:
total += (len(json.dumps(i)) - len(i))
print(total)