mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-23 21:11:08 +00:00
Adding doctests to frequency_finder.py (#10341)
* Update frequency_finder.py * Update frequency_finder.py --------- Co-authored-by: Christian Clauss <cclauss@me.com>
This commit is contained in:
parent
dab4e64896
commit
76acc6de60
|
@ -49,6 +49,15 @@ def get_item_at_index_zero(x: tuple) -> str:
|
|||
|
||||
|
||||
def get_frequency_order(message: str) -> str:
|
||||
"""
|
||||
Get the frequency order of the letters in the given string
|
||||
>>> get_frequency_order('Hello World')
|
||||
'LOWDRHEZQXJKVBPYGFMUCSNIAT'
|
||||
>>> get_frequency_order('Hello@')
|
||||
'LHOEZQXJKVBPYGFWMUCDRSNIAT'
|
||||
>>> get_frequency_order('h')
|
||||
'HZQXJKVBPYGFWMUCLDRSNIOATE'
|
||||
"""
|
||||
letter_to_freq = get_letter_count(message)
|
||||
freq_to_letter: dict[int, list[str]] = {
|
||||
freq: [] for letter, freq in letter_to_freq.items()
|
||||
|
|
Loading…
Reference in New Issue
Block a user