Skip to content

Commit 76acc6d

Browse files
ialokocclauss
andauthored
Adding doctests to frequency_finder.py (TheAlgorithms#10341)
* Update frequency_finder.py * Update frequency_finder.py --------- Co-authored-by: Christian Clauss <[email protected]>
1 parent dab4e64 commit 76acc6d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

strings/frequency_finder.py

+9
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,15 @@ def get_item_at_index_zero(x: tuple) -> str:
4949

5050

5151
def get_frequency_order(message: str) -> str:
52+
"""
53+
Get the frequency order of the letters in the given string
54+
>>> get_frequency_order('Hello World')
55+
'LOWDRHEZQXJKVBPYGFMUCSNIAT'
56+
>>> get_frequency_order('Hello@')
57+
'LHOEZQXJKVBPYGFWMUCDRSNIAT'
58+
>>> get_frequency_order('h')
59+
'HZQXJKVBPYGFWMUCLDRSNIOATE'
60+
"""
5261
letter_to_freq = get_letter_count(message)
5362
freq_to_letter: dict[int, list[str]] = {
5463
freq: [] for letter, freq in letter_to_freq.items()

0 commit comments

Comments
 (0)