Android & iPhone apps are coming soon. Log in for a plan and reminders made for you →

Coding basics · 20 of 20

Count the vowels

Return how many vowels (a, e, i, o, u, upper or lower case) are in the string.

What you need

A string works like a list of characters: for ch in s visits each one. in checks whether something appears, and .lower() makes a lower-case copy.

for ch in "Hi!":
    print(ch)          # H, i, !
"e" in "hello"       # True
"A".lower()          # "a"

Examples

Input s = "hello world"

Output 3

Input s = "AEIOU"

Output 5

Your code · Python

Stuck?