Skip to content

Conversation

@AndriiUser
Copy link

No description provided.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

Great work on this task! I'm approving your solution because it correctly implements the count_occurrences function and meets all functional requirements, including case-insensitive counting.

While your loop-based approach is perfectly valid, a more concise and Pythonic way to solve this would be to use built-in string methods as suggested in the task guidelines. For future reference, you could simplify your code to a single line by combining a case-conversion method like .lower() with the .count() method. Keep up the excellent effort!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

Comment on lines +2 to +6
count = 0
for lett in phrase.upper():
if lett == letter.upper():
count += 1
return count

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This loop-based approach works correctly, which is great! For a more Pythonic and concise solution, as recommended in the task guidelines, you could explore Python's built-in string methods. Is there a method that can count occurrences of a substring directly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants