Count vowels in a string
Write a function named count_vowels that takes a string text as input and returns the number of vowels (A, E, I, O, U) in the string. Count both uppercase and lowercase vowels, and use a for loop.
Complete the supplied function in Listing 1. Keep its signature and use the checks below it.
TipHint
len(text) returns the number of characters, so len("cat") is 3 and len("") is 0. A for loop over a string visits its characters in order. String indexing starts at 0, so "cat"[0] is "c"; the index must refer to an existing character.
assert condition stops the check with an AssertionError when the condition is false. character in text checks membership; "a" in "cat" is True.