Question
#-------------------------------------------------- # 2222222222222222222222222222222222222222222222222 # test_remove_short_synonyms() #-------------------------------------------------- Define the remove_short_synonyms() function which is passed a dictionary as a parameter. The keys of the parameter dictionary
#-------------------------------------------------- # 2222222222222222222222222222222222222222222222222 # test_remove_short_synonyms() #-------------------------------------------------- """
Define the remove_short_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 less than 7 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_short_synonyms(synonyms_dict) print("1.") print_dict_in_key_order(synonyms_dict) print()
synonyms_dict = {'come' : ['approach', 'advance', 'near', 'arrive', 'reach'], 'show' : ['display', 'exhibit', 'present', 'note', 'point to', 'indicate',
'explain', 'reveal', 'prove', 'demonstrate', 'expose'], 'good' : ['excellent', 'fine', 'superior', 'wonderful', 'grand', 'superb', 'edifying'], 'bad' : ['evil', 'immoral', 'wicked', 'rotten', 'contaminated', 'spoiled',
'defective', 'substandard', 'faulty', 'improper', 'inappropriate']
} remove_short_synonyms(synonyms_dict) print("2.") print_dict_in_key_order(synonyms_dict)
prints:
1. beautiful : ['dazzling', 'handsome', 'magnificent', 'splendid'] dangerous : ['hazardous', 'perilous', 'uncertain'] look : [] put : ['achieve', 'set aside'] slow : ['gradual', 'leisurely', 'tedious', 'unhurried']
2. bad : ['contaminated', 'defective', 'immoral', 'improper', 'inappropriate', 'spoiled', 'substandard'] come : ['advance', 'approach'] good : ['edifying', 'excellent', 'superior', 'wonderful'] show : ['demonstrate', 'display', 'exhibit', 'explain', 'indicate', 'point to', 'present'] """
def remove_short_synonyms(synonyms_dict):
pass
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started