This commit is contained in:
Patrik Tulach 2026-10-06 13:44:15 +02:00
parent d9fa93a26c
commit 0e1ca921d6

View File

@ -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
return dict
print(count_words("""To je heslo: 'HESLO 123'!", zvolala postava zo seriálu Panelák.\nPotom som utiekol."""))