Read the question, write Python on the right, then Run or Check.
QuestionHint and solution stay closed until you open them
Read one word and print how many vowels (a, e, i, o, u) it contains.
Count both uppercase and lowercase vowels — normalise the case first so you only check one set.
Input. One line: a word.
Output. One integer: the vowel count.
Examples
Input
Programming
Output
3
Input
sky
Output
0
Hint
- Lowercase the word with .lower() so "A" and "a" are treated the same.
- sum(1 for c in word if c in "aeiou") counts them in one pass.
Show correct code
Peek only after you have tried. You can still Check your own version.
word = input().strip()
print(sum(1 for c in word.lower() if c in "aeiou"))
main.pyPython · Ctrl + Enter runs
ResultIdle
Run to see output. Check grades the tests.