Question: def createDictionaryTrie(file_name): >>> trie = createDictionaryTrie(words.txt) >>> trie == {'b': {'a': {'l': {'l': {'word': True}}, 't': {'s': {'word': True}}}, 'i': {'r': {'d': {'word': True}},
def createDictionaryTrie(file_name): """ >>> trie = createDictionaryTrie("words.txt") >>> trie == {'b': {'a': {'l': {'l': {'word': True}}, 't': {'s': {'word': True}}}, 'i': {'r': {'d': {'word': True}},\ 'n': {'word': True}}, 'o': {'y': {'word': True}}}, 't': {'o': {'y': {'s': {'word': True}}},\ 'r': {'e': {'a': {'t': {'word': True}}, 'e': {'word': True}}}}} True """ with open(file_name, "r") as f: contents = ( f.read() ) # You might change .read() for .readlines() if it suits your implementation better # - YOUR CODE STARTS HERE
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
