Skip to content

Commit da6b9e9

Browse files
yaadhuupre-commit-ci[bot]MaximSmolskiy
authored
Use TypeError for non-string input in count_vowels (#14196)
* Use TypeError for non-string input in count_vowels * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix docstring and improve input validation in kth_lexicographic_permutation * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update kth_lexicographic_permutation.py --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
1 parent 1ae906a commit da6b9e9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

strings/count_vowels.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def count_vowels(s: str) -> int:
2222
1
2323
"""
2424
if not isinstance(s, str):
25-
raise ValueError("Input must be a string")
25+
raise TypeError("Input must be a string")
2626

2727
vowels = "aeiouAEIOU"
2828
return sum(1 for char in s if char in vowels)

0 commit comments

Comments
 (0)