Question: Python: From the specified dictionary file containing one word per line, return a list of words whose lengths are within the user-specified bounds. So, for
Python: From the specified dictionary file containing one 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.
Below is an incomplete function with the parameters we are to use and doc string examples of how it should work. Your code should start at and replace the word 'pass':
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
