Skip to content

Commit 602f94b

Browse files
authored
fix: space count in strings/word_occurrence.py
1 parent 4b78c69 commit 602f94b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

strings/word_occurrence.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Created by sarathkaul on 17/11/19
2+
# Modified by Arkadip Bhattacharya(@darkmatter18) on 20/04/2020
23
from collections import defaultdict
34

45

@@ -15,6 +16,7 @@ def word_occurence(sentence: str) -> dict:
1516
# Creating a dictionary containing count of each word
1617
for word in sentence.split(" "):
1718
occurrence[word] += 1
19+
if '' in occurrence.keys(): occurrence.pop('')
1820
return occurrence
1921

2022

0 commit comments

Comments
 (0)