From 63a4107fd4cd2fe2894e4e3c1cfd396346c222ea Mon Sep 17 00:00:00 2001 From: Maksym Kurets Date: Wed, 7 Oct 2026 19:30:17 +0200 Subject: [PATCH] Fix word count punctuation and apostrophe stripping --- u4/word_count.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/u4/word_count.py b/u4/word_count.py index ba1bf66..2de62b4 100644 --- a/u4/word_count.py +++ b/u4/word_count.py @@ -1,14 +1,11 @@ def count_words(phrase): slovnik1 = {} zbirac = phrase.lower() - for simbolii in r",._:;!?@#$%^&*()-+=/\|[]{}<>~`""": zbirac = zbirac.replace(simbolii, " ") - slova1 = zbirac.split() for gns in slova1: cisteslovo = gns.strip("'") if cisteslovo: slovnik1[cisteslovo] = slovnik1.get(cisteslovo, 0) + 1 - return slovnik1