Question: Question 2 (50 points): Given a string, write a function that counts the vowels of the English alphabet (a, e, i, o, u) and
Question 2 (50 points): Given a string, write a function that counts the vowels of the English alphabet (a, e, i, o, u) and returns the result as a dictionary. For example, astr="Lorem ipsum ..." result = count vowels (astr) print (result) is required to print something like: (number of counts are dummy in the following) {'a':10, 'e': 15, 1:10, 0:20, 'u' :15) Note: Don't forget to count vowels in capital letters. Let's say you have defined a string named astr def countvowels (x): # Write your code here pass # Delete this line if you copy this to your workfile. print (count vowels (astr)) prints, ('a':10, 'e': 15, 'i':10, 'o' :20, 'u':15)
Step by Step Solution
3.41 Rating (157 Votes )
There are 3 Steps involved in it
python def countvowelsx vowels a e i ... View full answer
Get step-by-step solutions from verified subject matter experts
