Skip to content

Conversation

@yaadhuu
Copy link

@yaadhuu yaadhuu commented Jan 22, 2026

Summary

This pull request updates the exception type raised in count_vowels when the input
is not a string.

Currently, the function raises ValueError for invalid input types. Since this case
represents an incorrect input type rather than an invalid value, this PR replaces
it with TypeError, which aligns better with Python’s exception conventions.

What changed

  • Replaced ValueError with TypeError for non-string inputs in count_vowels
  • No changes to the core logic or existing doctests

Why this change

Using TypeError for incorrect input types makes the function’s behavior clearer and
more consistent with standard Python practices, improving readability and correctness
for users.

Checklist

  • I have read the CONTRIBUTING guidelines
  • This pull request contains my own work
  • This PR changes only one file and keeps the scope minimal

@algorithms-keeper algorithms-keeper bot added the awaiting reviews This PR is ready to be reviewed label Jan 22, 2026
@yaadhuu yaadhuu closed this Jan 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting reviews This PR is ready to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant