Question: Define a function named create_consonant_dictionary(words) which takes a list of words as a parameter. The function returns a dictionary where the keys are consonants in
Define a function named create_consonant_dictionary(words) which takes a list of words as a parameter. The function returns a dictionary where the keys are consonants in lowercase and the corresponding values are the list of word lengths for all words in the list that start with that consonant. The lists of numbers must be in sorted ascending order. Note: you can assume there will be no punctuation characters in the parameter list (i.e. only letters) and the list is not empty. You should convert all words to lower case.
For example:
| Test | Result |
|---|---|
words = ['Technology', 'affects', 'the', 'way', 'teachers', 'teach', 'and', 'students', 'learn', 'sacculus'] a_dict = create_consonant_dictionary(words) for key in sorted(a_dict.keys()): print(key, a_dict[key]) | l [5] s [8, 8] t [3, 5, 8, 10] w [3] |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
