Skip to content

Commit 518dadb

Browse files
committed
Solution
1 parent 22135be commit 518dadb

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

app/main.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
def count_occurrences(phrase: str, letter: str) -> int:
22
"""
3-
Counts the number of times a specific letter appears in a phrase,
4-
ignoring case sensitivity.
5-
6-
The function uses Python's built-in string methods for conciseness
7-
and efficiency.
8-
9-
:param phrase: The input string to search within.
10-
:param letter: The single-character string to count occurrences of.
11-
:return: The total count of the letter in the phrase as an integer.
3+
Count occurrences of a letter in a phrase (case insensitive).
4+
:param phrase: The phrase to search within.
5+
:param letter: The letter to count occurrences of.
6+
:return: The number of occurrences of the letter in the phrase.
127
"""
138

149
# First, convert the phrase and the search letter to lowercase.
@@ -18,4 +13,4 @@ def count_occurrences(phrase: str, letter: str) -> int:
1813

1914
# Use the built-in .count() method
2015

21-
return phrase_lower.count(letter_lower)
16+
return phrase_lower.count(letter_lower)

0 commit comments

Comments
 (0)