From bb66935925d0ac9350330274260f73ea6f6245a0 Mon Sep 17 00:00:00 2001 From: Ivan Korvatko Date: Mon, 10 Nov 2025 17:31:31 +0200 Subject: [PATCH 1/4] Solution --- app/main.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/main.py b/app/main.py index 37b9f338b..dbcc67708 100644 --- a/app/main.py +++ b/app/main.py @@ -1,3 +1,10 @@ def count_occurrences(phrase: str, letter: str) -> int: - # write your code here - pass + + + + + counter = 0 + for character in phrase: + if character.lower() == letter.lower(): + counter += 1 + return counter From 3dcffdbadeb811db423b1407fa282008de3fdf5d Mon Sep 17 00:00:00 2001 From: Ivan Korvatko Date: Mon, 10 Nov 2025 17:41:59 +0200 Subject: [PATCH 2/4] implement py-count-occurrences --- app/main.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/main.py b/app/main.py index dbcc67708..0bc258ea8 100644 --- a/app/main.py +++ b/app/main.py @@ -2,9 +2,10 @@ def count_occurrences(phrase: str, letter: str) -> int: + return phrase.lower().count(letter.lower()) + + + + + - counter = 0 - for character in phrase: - if character.lower() == letter.lower(): - counter += 1 - return counter From ccd70146bdb21bfce52378a12e1f460e38536fe7 Mon Sep 17 00:00:00 2001 From: Ivan Korvatko Date: Mon, 10 Nov 2025 17:49:08 +0200 Subject: [PATCH 3/4] implement py-count-occurrences(changed) --- app/main.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/main.py b/app/main.py index 0bc258ea8..13430980c 100644 --- a/app/main.py +++ b/app/main.py @@ -1,7 +1,4 @@ def count_occurrences(phrase: str, letter: str) -> int: - - - return phrase.lower().count(letter.lower()) @@ -9,3 +6,4 @@ def count_occurrences(phrase: str, letter: str) -> int: + From be73e32a75059c4094eac9f11cb46ab48db40af7 Mon Sep 17 00:00:00 2001 From: Ivan Korvatko Date: Mon, 10 Nov 2025 18:04:03 +0200 Subject: [PATCH 4/4] implement py-count-occurrences(last changed) --- app/main.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/main.py b/app/main.py index 13430980c..9a6dbb647 100644 --- a/app/main.py +++ b/app/main.py @@ -1,9 +1,9 @@ def count_occurrences(phrase: str, letter: str) -> int: - return phrase.lower().count(letter.lower()) - - - - - - + """ + 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. + """ + return phrase.lower().count(letter.lower())