← Back to Dictionaries
Question 301
Count Vowels By Letter
Count Vowels By Letter
Read one word from the input (one line, no prompt) and count only its vowels. The dict vowels already holds the five vowels as keys with a count of 0 each; loop over the characters of the word and, using in to check whether the character is one of the keys, add one to its count when it is. Print the dict after the loop. Input: one line. Output: one line, the printed dict with all five counts.
Expected Output:
{'a': 3, 'e': 0, 'i': 0, 'o': 0, 'u': 0}= newline. The output ends with a newline — print one after the last line.
Hints3 available
Sign in to use hintsTopics:
Dictionaries
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.