From 3d87fab3343d342dfaf39c86910c3c8adf5e3118 Mon Sep 17 00:00:00 2001 From: kleph Date: Fri, 10 Dec 2021 14:55:03 +0100 Subject: [PATCH] Test linter and fix pycharm's style warning --- 10/10.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/10/10.py b/10/10.py index ecda15f..f948f45 100755 --- a/10/10.py +++ b/10/10.py @@ -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}')