How can you make the output: ‘a’:0 ‘e’:0 ‘i’:0 ‘o’:0 ‘u’:0 instead…
Question Answered step-by-step How can you make the output: ‘a’:0 ‘e’:0 ‘i’:0 ‘o’:0 ‘u’:0 instead… How can you make the output:’a’:0’e’:0’i’:0’o’:0’u’:0instead of {‘a’:0, ‘e’:0,’i’:0,’o’:0,’u’:0}The code is:def count_vowels(string,vowels_count): a_count = 0 e_count = 0 i_count = 0 o_count = 0 u_count = 0 #Iterate string for char in string: if char == ‘a’ or char == ‘A’: a_count += 1 elif char == ‘e’ or char == ‘E’: e_count += 1 elif char == ‘i’ or char == ‘I’: i_count += 1 elif char == ‘o’ or char == ‘O’: o_count += 1 elif char == ‘u’ or char == ‘U’: u_count += 1 vowels_count[‘a’]=a_count vowels_count[‘e’]=e_count vowels_count[‘i’]=i_count vowels_count[‘o’]=o_count vowels_count[‘u’]=u_count print(vowels_count)#Test.vowels_count=dict()count_vowels(”,vowels_count) Computer Science Engineering & Technology Java Programming CIT 202 Share QuestionEmailCopy link Comments (0)


