From a9a8e3d16ba81ea9a50badbcf18ac417b6a7bcbd Mon Sep 17 00:00:00 2001 From: Sasha Stopochkin Date: Thu, 23 Oct 2025 15:43:56 +0300 Subject: [PATCH 1/3] implement py-count-occurrences --- app/main.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/main.py b/app/main.py index 37b9f338b..e613d4440 100644 --- a/app/main.py +++ b/app/main.py @@ -1,3 +1,2 @@ def count_occurrences(phrase: str, letter: str) -> int: - # write your code here - pass + return phrase.lower().count(letter.lower()) From e15d365fec374b0e6157cd9830098834ac531e12 Mon Sep 17 00:00:00 2001 From: Sasha Stopochkin Date: Thu, 23 Oct 2025 15:49:31 +0300 Subject: [PATCH 2/3] implement py-count-occurrences2 --- app/main.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/main.py b/app/main.py index e613d4440..06cf13b7a 100644 --- a/app/main.py +++ b/app/main.py @@ -1,2 +1,12 @@ def count_occurrences(phrase: str, letter: str) -> int: + """ + Counts how many times a given letter appears in a phrase, ignoring case. + + Args: + phrase (str): The input string to search within. + letter (str): The letter to count in the phrase. + + Returns: + int: The number of times the letter appears in the phrase. + """ return phrase.lower().count(letter.lower()) From efe3ee93dd43e66a2076c210d5cfe1190bcad105 Mon Sep 17 00:00:00 2001 From: Sasha Stopochkin Date: Thu, 23 Oct 2025 15:53:06 +0300 Subject: [PATCH 3/3] implement py-count-occurrences3 --- app/main.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/app/main.py b/app/main.py index 06cf13b7a..9a6dbb647 100644 --- a/app/main.py +++ b/app/main.py @@ -1,12 +1,9 @@ def count_occurrences(phrase: str, letter: str) -> int: """ - Counts how many times a given letter appears in a phrase, ignoring case. + Count occurrences of a letter in a phrase (case insensitive). - Args: - phrase (str): The input string to search within. - letter (str): The letter to count in the phrase. - - Returns: - int: The number of times the letter appears in the phrase. + :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. """ return phrase.lower().count(letter.lower())