From 67db22b7f7a15ffbc498bf4c44dbf7ef5420433d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=AF=D1=80=D0=BE=D1=81=D0=BB=D0=B0=D0=B2=20=D0=A8=D0=B5?= =?UTF-8?q?=D0=B2=D1=87=D0=B5=D0=BD=D0=BA=D0=BE?= Date: Wed, 11 Sep 2024 19:21:09 +0300 Subject: [PATCH 1/3] Solution --- app/main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/main.py b/app/main.py index 4ccbb02b..62c80aac 100644 --- a/app/main.py +++ b/app/main.py @@ -14,4 +14,8 @@ def count_occurrences(phrase: str, letter: str) -> int: :param letter: letter to find occurrences of it :return: count occurrences of letter in phrase """ - # write your code here + counter = 0 + for char in phrase: + if char.lower() == letter.lower(): + counter += 1 + return counter From 6cc7802250630bcd669e46de62bb4442d8230395 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=AF=D1=80=D0=BE=D1=81=D0=BB=D0=B0=D0=B2=20=D0=A8=D0=B5?= =?UTF-8?q?=D0=B2=D1=87=D0=B5=D0=BD=D0=BA=D0=BE?= Date: Thu, 12 Sep 2024 18:08:37 +0300 Subject: [PATCH 2/3] Solution --- app/main.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/app/main.py b/app/main.py index 62c80aac..8b0f5717 100644 --- a/app/main.py +++ b/app/main.py @@ -14,8 +14,4 @@ def count_occurrences(phrase: str, letter: str) -> int: :param letter: letter to find occurrences of it :return: count occurrences of letter in phrase """ - counter = 0 - for char in phrase: - if char.lower() == letter.lower(): - counter += 1 - return counter + return phrase.lower().count(letter.lower()) From 73478899b2a8d3131bca95d38788e32395c2b383 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=AF=D1=80=D0=BE=D1=81=D0=BB=D0=B0=D0=B2=20=D0=A8=D0=B5?= =?UTF-8?q?=D0=B2=D1=87=D0=B5=D0=BD=D0=BA=D0=BE?= Date: Thu, 12 Sep 2024 18:13:34 +0300 Subject: [PATCH 3/3] Fix in one line --- app/main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/app/main.py b/app/main.py index 8b0f5717..06d4c1fe 100644 --- a/app/main.py +++ b/app/main.py @@ -15,3 +15,4 @@ def count_occurrences(phrase: str, letter: str) -> int: :return: count occurrences of letter in phrase """ return phrase.lower().count(letter.lower()) +