Final answer:
To write a function named count_vowels that counts the number of times each vowel appears in a string and stores the counts in a dictionary, you can use the provided code as a starting point.
Step-by-step explanation:
To write a function named count_vowels, you can use the following code:
def count_vowels(string, dictionary):
vowels = ['a', 'e', 'i', 'o', 'u']
for vowel in vowels:
count = string.count(vowel)
dictionary[vowel] = count
In this function, we iterate over a list of vowels and use the count() method to count the number of times each vowel appears in the string. Then, we assign the count to the key in the dictionary.
For example, if the string is 'Now is the time', the dictionary will have the following key-value pairs: 'a': 0, 'e': 2, 'i': 2, 'o': 1, 'u': 0. Note that we do not return anything from the function, as the goal is to update the dictionary in-place.