mirror of
https://github.com/TheAlgorithms/Python.git
synced 2026-09-28 21:45:27 +08:00
Add docstring frequency finder (#14833)
* corrected the typos * added the docstrings in the functions * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update camel_case_to_snake_case.py * Improve docstring clarity in frequency_finder.py Updated docstrings for get_letter_count and get_item_at_index_zero functions for clarity. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Christian Clauss <cclauss@me.com>
This commit is contained in:
co-authored by
pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Christian Clauss
parent
5bd6b19c16
commit
cbe3204926
@@ -36,6 +36,8 @@ LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
|
||||
|
||||
def get_letter_count(message: str) -> dict[str, int]:
|
||||
"""get_letter_count() takes message as a parameter, which should be a string.
|
||||
It returns a dictionary where the string is a key and an integer is a value."""
|
||||
letter_count = dict.fromkeys(string.ascii_uppercase, 0)
|
||||
for letter in message.upper():
|
||||
if letter in LETTERS:
|
||||
@@ -45,6 +47,7 @@ def get_letter_count(message: str) -> dict[str, int]:
|
||||
|
||||
|
||||
def get_item_at_index_zero(x: tuple) -> str:
|
||||
"""Take a tuple x as a parameter and return a string."""
|
||||
return x[0]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user