From 54a2270b008f9365a332d3f4a21be28b750606ed Mon Sep 17 00:00:00 2001 From: Kyrylo Chepenko Date: Wed, 3 Jan 2024 15:12:32 +0200 Subject: [PATCH] Solution --- app/main.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/main.py b/app/main.py index 4ccbb02b..69cdcb5f 100644 --- a/app/main.py +++ b/app/main.py @@ -15,3 +15,10 @@ def count_occurrences(phrase: str, letter: str) -> int: :return: count occurrences of letter in phrase """ # write your code here + phrase_lower = phrase.lower() + letter_lower = letter.lower() + + # Use a generator expression to count occurrences + occurrences = sum(1 for char in phrase_lower if char == letter_lower) + + return occurrences