Skip to content

Commit 435f37f

Browse files
committed
Use TypeError for non-string input in count_vowels
1 parent ca5b8c1 commit 435f37f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

strings/count_vowels.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ 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")
26+
2627

2728
vowels = "aeiouAEIOU"
2829
return sum(1 for char in s if char in vowels)

0 commit comments

Comments
 (0)