Skip to contentKEEP THE CRAFTTHE SANCTUARY

Count Vowels

Count how many vowels a string contains, ignoring case.

The problem

Implement count_vowels(text). Return how many characters in text are vowels: a, e, i, o, or u. Uppercase and lowercase both count, so "OpenAI" has 4 vowels. Any other character, including y, is not a vowel.

Starter code

def count_vowels(text):
    pass

Public examples

  1. text = "OpenAI"gives4

Solving it in the practice book needs an active paid plan.

Open it in the practice book
One thought at a time.