Directory Structure for 2022

This commit is contained in:
2022-11-30 21:05:44 +00:00
parent d370c43087
commit 9289b75581
19 changed files with 806 additions and 0 deletions

34
2021/Day-10/day10-1.py Normal file
View File

@@ -0,0 +1,34 @@
#!/usr/bin/python3
totalScore = 0
closers = {
'(':')',
'{':'}',
'[':']',
'<':'>'
}
points = {
')':3,
']':57,
'}':1197,
'>':25137
}
with open('/home/jake/Documents/AoC-2021/Day-10/input.txt') as inputFile:
for line in inputFile:
line = line.strip('\n')
i = 0
expecting = []
i = 0
for char in line:
if(char in closers):
expecting.insert(0,closers[char])
else:
if(expecting[i] != char):
totalScore += points[char]
break
else:
del expecting[i]
print("Our total score was: " + str(totalScore))