Skip to content

Commit

Permalink
solution with one line code
Browse files Browse the repository at this point in the history
  • Loading branch information
mlupekha committed Feb 7, 2024
1 parent 87763f4 commit 3a6feba
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +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
"""
count = 0

for char in phrase:
if letter.lower() in char.lower():
count += 1
return count
return phrase.lower().count(letter.lower())

0 comments on commit 3a6feba

Please sign in to comment.