Question: Hey I have this question here. As far as I can get is pulling out all of the keys in the dict that are less

Hey I have this question here. As far as I can get is pulling out all of the keys in the dict that are less than 7 characters long and storing them in a separate list but I cant get any further than that, none of the material that we've covered in class seems to give me any direction. I believe the way they want us to answer this question is to delete the keys that are greater than 7 characters in length but I keep getting errors

Hey I have this question here. As far as I can get

is pulling out all of the keys in the dict that are

Thanks!

Define the remove_long_synonyms function which is passed a dictionary as a parameter. The keys of the parameter dictionary are words and the corresponding values are lists of synonyms (synonyms are words which have the same or nearly the same meaning). The function removes all the synonyms which have 7 or more characters from each corresponding list of synonyms. As well, the function sorts each corresponding list of synonyms. For example, the following code: synonyms_dict = { 'look': ['gaze', 'see', 'glance', 'watch', 'peruse'], 'put': ['place', 'set', 'attach', 'keep', 'save', 'set aside', 'effect', 'achieve', 'do', 'build'], 'beautiful': ['pretty', 'lovely', 'handsome', 'dazzling', 'splendid', 'magnificent'], 'slow': ['unhurried', 'gradual', 'leisurely', 'late', 'behind', 'tedious', 'slack'], 'dangerous': ['perilous', 'hazardous', 'uncertain'] remove_long_synonyms (synonyms_dict) print("1.") print_dict_in_key_order(synonyms_dict) prints: 1. beautiful : ['lovely', 'pretty'] dangerous : [] look : ['gaze', 'glance', 'peruse', 'see', 'watch'] put : ['attach', 'build', 'do', 'effect', 'keep', 'place', 'save', 'set'] slow : ['behind', 'late', 'slack']

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!