diff --git a/strings/count_vowels.py b/strings/count_vowels.py index 8a52b331c81b..63f75bbec1c6 100644 --- a/strings/count_vowels.py +++ b/strings/count_vowels.py @@ -1,28 +1,30 @@ def count_vowels(s: str) -> int: - """ - Count the number of vowels in a given string. + """Count the number of vowels in a given string. + + Args: + s (str): Input string to count vowels in. - :param s: Input string to count vowels in. - :return: Number of vowels in the input string. + Returns: + int: Number of vowels in the input string. Examples: - >>> count_vowels("hello world") - 3 - >>> count_vowels("HELLO WORLD") - 3 - >>> count_vowels("123 hello world") - 3 - >>> count_vowels("") - 0 - >>> count_vowels("a quick brown fox") - 5 - >>> count_vowels("the quick BROWN fox") - 5 - >>> count_vowels("PYTHON") - 1 + >>> count_vowels("hello world") + 3 + >>> count_vowels("HELLO WORLD") + 3 + >>> count_vowels("123 hello world") + 3 + >>> count_vowels("") + 0 + >>> count_vowels("a quick brown fox") + 5 + >>> count_vowels("the quick BROWN fox") + 5 + >>> count_vowels("PYTHON") + 1 """ if not isinstance(s, str): - raise ValueError("Input must be a string") + raise TypeError("Input must be a string") vowels = "aeiouAEIOU" return sum(1 for char in s if char in vowels)