diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..68b819a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.test.py \ No newline at end of file diff --git a/u4/word_count.py b/u4/word_count.py index a7905ab..bb887a6 100644 --- a/u4/word_count.py +++ b/u4/word_count.py @@ -6,10 +6,10 @@ def count_words(sentance: str) -> dict: SPECIAL_CHAR = oct(7) - delims = [":", "?", "!", "\n", "\t", ",", ".", "_", '&', '@', '$', '%', '^', '&'] - del_chars = ['"'] + delims = ":?!\n\t,._&@$^&*()%" + del_chars = '"' - forbidden = delims + del_chars + [" ", "'", ""] + forbidden = list(delims) + list(del_chars) + [" ", "'", ""] for i, ch in enumerate(sent_list): if(ch in delims): @@ -28,5 +28,3 @@ def count_words(sentance: str) -> dict: words[w.replace(SPECIAL_CHAR, "'")] += 1 return dict(words) - -print(count_words("""seriál: seriálik ako Dunaj: Panelák!!&@$%^&""")) \ No newline at end of file