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 a docstring. The task description requires a docstring that explains the function's purpose, parameters, and return value. Please add one as shown in the example.

Copy link
Author

Choose a reason for hiding this comment

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

)

# 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.
"""


phrase_lower = phrase.lower()
letter_lower = letter.lower()


return phrase_lower.count(letter_lower)
Loading