From 0e1ca921d64597e821ac6d0282154483f17b6a6b Mon Sep 17 00:00:00 2001 From: Patrik Tulach Date: Tue, 6 Oct 2026 13:44:15 +0200 Subject: [PATCH] u4 --- u4/word_count.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/u4/word_count.py b/u4/word_count.py index 2e6771e..6da2abf 100644 --- a/u4/word_count.py +++ b/u4/word_count.py @@ -1,6 +1,6 @@ def count_words(sentence): dict = {} - separators = [".", ",", ":", "!", "?", "\n", "\t", "'", " "] + separators = [".", ",", ":", "!", "?", "\n", "\t", "'", " ", '"'] previous_i = 0 for i, chr in enumerate(sentence): @@ -11,9 +11,9 @@ def count_words(sentence): if word in separators or word == "": continue if word in dict: - print(dict) dict[word] = dict[word] + 1 - print(dict) else: dict.update({word : 1}) - return dict \ No newline at end of file + return dict + +print(count_words("""To je heslo: 'HESLO 123'!", zvolala postava zo seriálu Panelák.\nPotom som utiekol.""")) \ No newline at end of file