Challenge: Count the Number of Vowels in a String
Write a recursive function that counts the number of vowels in a given string.
We'll cover the following
Write a program that defines a recursive function counts_vowels()
that accepts a string and counts the number of vowels in the string:
- Input: A string
s
, an indexidx
(initially 0 a), andcount
(initially 0). - Output: The number of vowels in the input string.
Get hands-on with 1200+ tech skills courses.