Challenge: Count the Number of Vowels in a String

Write a recursive function that counts the number of vowels in a given string.

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 index idx (initially 0 a), and count (initially 0).
  • Output: The number of vowels in the input string.

Get hands-on with 1400+ tech skills courses.