word_data : {'alice': ['between', 'cushion', 'pumpkin', 'resting', 'sitting', 'suppose', 'talking', 'testing', 'thought', 'witches'], 'jeeves': ['amazing', 'causing', 'exactly', 'fellows', 'lantern', 'minutes', 'morning', 'pumpkin', 'respect', 'spilled', 'testing'], 'peterpan': ['corners', 'lantern', 'morning', 'sighted', 'testing', 'witches'], 'sherlock': ['actions', 'drawing', 'dubious', 'emotion', 'himself', 'lantern', 'machine', 'mention', 'motives', 'perfect', 'precise', 'pumpkin', 'results', 'testing', 'trained'], 'tomsawyer': ['lantern', 'moments', 'spirits', 'started', 'testing', 'witches', 'without']}
Python Please
some words are unique in each (key or passage) and some are common, the program should figure out unique word only:
The program should compute and display:
The count of words unique to each passage
Note: define function is not allowed.
The output for this dictionary should look like this
# Words unique to each passage:
alice : 7 jeeves : 7 peterpan : 2 sherlock : 12 tomsawyer : 4
The answer to this question mainly involves in three steps
1.''' separating the key and value in two different lists values in
f and keys in o'''
2.'''finding the unique words from the entire passage''' by using
the collection module and counters
3.'''for each word in the value for the particular key we are
checking the word is present in the unique words'''
the ouput is as follows:
word_data : {'alice': ['between', 'cushion', 'pumpkin', 'resting', 'sitting', 'suppose', 'talking', 'testing', 'thought', 'witches'], 'jeeves': ['amazing', 'causing',...