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.

Listing 1: Starter function and supplied checks for count vowels in a string.
def count_vowels(text: str) -> int:
    # Add code here!
    pass


assert count_vowels("Hello, World!") == 3
assert count_vowels("") == 0
assert count_vowels("AEIOUaeiou") == 10
assert count_vowels("12345") == 0

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.