From 0d35f715f4efd87d5f7d55533be897e7eb848af1 Mon Sep 17 00:00:00 2001 From: OneNewDev Date: Sat, 7 May 2022 19:50:36 +0200 Subject: [PATCH] reverse sorting and change upper letter multiplier --- tagger.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tagger.py b/tagger.py index f3889d3..6ff8010 100644 --- a/tagger.py +++ b/tagger.py @@ -43,12 +43,12 @@ class FileScanner(HTMLParser): if len(word) <= 3: score //= 2 upper_letters_count = len(upper_check.findall(tag_name)) - score *= upper_letters_count + score += upper_letters_count * 5 if word not in words_with_usage: words_with_usage[word] = Tag(name=tag_name, score=score) else: words_with_usage[word].score += score - sorted_list = sorted(words_with_usage.values(), key=lambda tag: tag.score, reverse=False) + sorted_list = sorted(words_with_usage.values(), key=lambda tag: tag.score, reverse=True) display_result(sorted_list) def handle_starttag(self, tag, attrs):