2015 / 08

This commit is contained in:
2024-11-10 17:54:07 +01:00
parent fd69220fe5
commit e0be09b6d3
7 changed files with 327 additions and 19 deletions

View File

@@ -2,7 +2,7 @@
# Date : 20XX.12.XX
# Python Code
# Developer : David Bandeira
import re
import sys,time
from helpingFunctions import *
@@ -13,13 +13,28 @@ aocYear = identifyYear(sys.argv[0])
path = getPath2Data(aocDay,aocYear)
filename = getFilename2Data(aocDay)
def cleanupData(dataRow):
return eval(dataRow)
def countData(dataRow):
lengthData = len(dataRow)
lengthCleanData = len(cleanupData(dataRow))
return lengthData-lengthCleanData
def countEscape(dataRow):
return 2+dataRow.count('\\')+dataRow.count('"')
def taskA (data) -> int:
gameScoreA = 0
gameScoreA=0
for dataRow in data:
gameScoreA+=countData(dataRow)
return gameScoreA
def taskB (data) -> int:
gameScoreB = 0
for dataRow in data:
gameScoreB+=countEscape(dataRow)
return gameScoreB
def task(task: int,data) -> int: