Test linter and fix pycharm's style warning

This commit is contained in:
kleph 2021-12-10 14:55:03 +01:00
parent 7bf8952928
commit 3d87fab334

View file

@ -5,7 +5,6 @@ def parse_file(file):
with open(file) as f:
i = 0
for line in f.readlines():
count_open = {'(': 0, '[': 0, '{': 0, '<': 0}
chunks = []
for c in line.strip():
if c in close_sign.values(): # open signs
@ -17,9 +16,9 @@ def parse_file(file):
count_score[c] += 1
close_sign = {')': '(', ']': '[' , '}': '{', '>': '<'}
count_score = {')': 0, ']': 0, '}': 0, '>':0}
score_table = {')': 3, ']': 57, '}': 1197, '>':25137}
close_sign = {')': '(', ']': '[', '}': '{', '>': '<'}
count_score = {')': 0, ']': 0, '}': 0, '>': 0}
score_table = {')': 3, ']': 57, '}': 1197, '>': 25137}
# parse_file('input_example.txt')
@ -28,7 +27,7 @@ parse_file('input.txt')
print(f'char score {count_score}')
score = 0
for c in close_sign:
score += count_score[c] * score_table[c]
for sign in close_sign:
score += count_score[sign] * score_table[sign]
print(f'score: {score}')