Skip to content

Commit 8305858

Browse files
Enhance docstring with usage examples
Added examples to the docstring for count_vowels_and_consonants function.
1 parent 8697b95 commit 8305858

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

strings/count_vowels_consonants.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ def count_vowels_and_consonants(text: str) -> tuple[int, int]:
1010
Returns:
1111
tuple[int, int]: A tuple containing (vowel_count,
1212
consonant_count).
13+
Examples:
14+
>>> count_vowels_and_consonants("Hello World")
15+
(3, 7)
16+
>>> count_vowels_and_consonants("AEIOU")
17+
(5, 0)
18+
>>> count_vowels_and_consonants("bcdf")
19+
(0, 4)
20+
>>> count_vowels_and_consonants("")
21+
(0, 0)
1322
"""
1423
vowels = set("aeiouAEIOU")
1524
vowel_count = 0

0 commit comments

Comments
 (0)