Question: Write in python filter_dict This function takes the name of a dictionary file that contains 1 word per line, and the minimum and maximum word
Write in python
filter_dict
This function takes the name of a dictionary file that contains 1 word per line, and the minimum and maximum word lengths. Your function will return a list of the words from the original dictionary file whose length is within the user-specified bounds. So for instance, if the min is 3 and max is 7, then only words with length >= 3 and length <= 7 will be returned in the list.
def filter_dict(filename, min, max): """ From the specified dictionary file containing 1 word per line, return a list of words whose lengths are within the user-specified bounds. So for instance, if the min is 3 and max is 7, then only words with length >= 3 and length <= 7 will be returned in the list.
:param filename: the dictionary file containing 1 word per line :param min: the min length (inclusive) of words to return :param max: the max length (inclusive) of words to return
>>> filter_dict('small_dict.txt', 3, 5) ['acted', 'bios', 'coder', 'find', 'gore', 'knife', 'racer']
>>> filter_dict('small_dict.txt', 7, 10) ['debased', 'shameful'] """ # replace pass below with your code pass
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
