File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
exercises/41-frequency-of-words Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 2
2
3
3
## 📝 Instructions:
4
4
5
- 1 . Write a program to compute the frequency of the words from the input. The output should output after sorting the key alphanumerically.
5
+ 1 . Write a function called ` compute_word_frequency() ` to compute the frequency of the words from a string input.
6
+
7
+ 2 . Put each word separated by a space in a dictionary and count its frequency.
8
+
9
+ 3 . Sort the dictionary alphanumerically and print in the console each key in a new line.
6
10
7
11
## 📎 Example input:
8
12
12
16
13
17
## 📎 Example output:
14
18
15
- ``` py
19
+ ``` text
16
20
2: 2
17
21
3.: 1
18
22
3?: 1
@@ -25,3 +29,7 @@ choosing: 1
25
29
or: 2
26
30
to: 1
27
31
```
32
+
33
+ ## 💡 Hint:
34
+
35
+ + You can put each word of a string in a list with the ` split() ` method, then it is easier to work on it.
You can’t perform that action at this time.
0 commit comments