Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions app/main.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
def count_occurrences(phrase: str, letter: str) -> int:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function is missing the required docstring. Task descriptions often include specific docstrings that need to be added to explain the function's purpose, parameters, and what it returns.

# write your code here
pass
"""
Count occurrences of a letter in a phrase (case insensitive).

:param phrase: The phrase to search within.
:param letter: The letter to count occurrences of.
:return: The number of occurrences of the letter in the phrase.
"""

lower_phrase = phrase.lower()
lower_letter = letter.lower()
count = lower_phrase.count(lower_letter)

return count