Skip to content

Commit

Permalink
Solution
Browse files Browse the repository at this point in the history
  • Loading branch information
Mazurkav committed Nov 9, 2024
1 parent d172e3d commit 88a9f91
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ def count_occurrences(phrase: str, letter: str) -> int:
:param letter: The letter to count occurrences of.
:return: The number of occurrences of the letter in the phrase.
"""
result = count_occurrences("Hello World","o")
print(result) # Output: 2, as the letter "o" appears twice.
count = 0
for char in phrase:
if char.lower() == letter.lower():
count += 1
return count


0 comments on commit 88a9f91

Please sign in to comment.