From ba4f802aeed7f13cad71bf1b3e9aba32d428e62d Mon Sep 17 00:00:00 2001 From: Iryna Brenko Date: Tue, 8 Oct 2024 10:11:19 +0300 Subject: [PATCH 1/3] Solution --- app/main.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/main.py b/app/main.py index 4ccbb02b..40400515 100644 --- a/app/main.py +++ b/app/main.py @@ -14,4 +14,9 @@ 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 8dc4ffc04d33d999b62a94eb633fbc16e938e1cf Mon Sep 17 00:00:00 2001 From: IrynaBrenko Date: Tue, 8 Oct 2024 11:05:03 +0300 Subject: [PATCH 2/3] Solution --- app/main.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/main.py b/app/main.py index 40400515..dac243c9 100644 --- a/app/main.py +++ b/app/main.py @@ -1,5 +1,5 @@ def count_occurrences(phrase: str, letter: str) -> int: - """ + """` Implement count_occurrences function: It takes a phrase and a letter and calculates the number of times @@ -18,5 +18,4 @@ def count_occurrences(phrase: str, letter: str) -> int: for char in phrase: if char.lower() == letter.lower(): counter += 1 - return counter - + return counter From f65591e915e127ad6a0130b1b8acee2c74564965 Mon Sep 17 00:00:00 2001 From: IrynaBrenko Date: Tue, 8 Oct 2024 13:08:08 +0300 Subject: [PATCH 3/3] fix change --- app/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/main.py b/app/main.py index dac243c9..62c80aac 100644 --- a/app/main.py +++ b/app/main.py @@ -1,5 +1,5 @@ def count_occurrences(phrase: str, letter: str) -> int: - """` + """ Implement count_occurrences function: It takes a phrase and a letter and calculates the number of times