Referring question vav, I assumed that you intended that we will not save the keys of the dictionary in the hashtable, but that question turns the picture around. On the other side I saw in the test() subroutine the following sequence:
h = SimpleDict(200) h.insert("ab", 2) h.insert("ef", 1) h.insert("cd", 3) if len(h.items()) != 3: print("error in SimpleDict.insert()")
d = count_words(["ab", "cd", "cd", "ef", "cd", "ab"]) if d is None: print("error in count_words()") if d != None and d.items() != None and len(d.items()) != 3: print("error in count_words()")
"items" returns a list of all we have saved in the dictionary (not only values), if we would somehow save there the keys, test() would raise "error"
Meaning you do not want us to save anything in the lists within the dictionary except the values themselves.
So I was wondering if I can also receive the text in the “sort_by_cnt” function and not only the output of “count_words”, so that we won’t save the keys in the dictionary itself.