-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCount_repetitions_of_words.py
More file actions
32 lines (22 loc) · 903 Bytes
/
Count_repetitions_of_words.py
File metadata and controls
32 lines (22 loc) · 903 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env python
# Author: Manug-github
# License: GNU GPLv3
"""Count the number of words in "Zen_of_Python.txt"?
Not case sensitive.
Words with apostrophe do not separate, "it's" is different from "it" or "is"
"""
import unittest
def number_of_repetitions(input_word) -> int:
"""Return repetitions of input_word"""
# code here
class AllUniqueTests(unittest.TestCase):
def test_all_unique(self):
self.assertTrue (number_of_repetitions("idea") == 3)
self.assertTrue (number_of_repetitions("is") == 10)
self.assertTrue (number_of_repetitions("explain") == 2)
self.assertTrue (number_of_repetitions("Complex") == 2)
self.assertTrue (number_of_repetitions("Unless") == 2)
self.assertTrue (number_of_repetitions("now") == 2)
self.assertTrue (number_of_repetitions("Zen") == 0)
if __name__ == "__main__":
unittest.main()