Question: Test Data''' >>> removePunctuation(Dots...................... many dots..X) ('Dots many dots X', {'.': 24}) >>> data = removePunctuation(I like chocolate cake!!(!! It's the best flavor..;.$ for real)

Test Data'''
>>> removePunctuation("Dots...................... many dots..X")
('Dots many dots X', {'.': 24})
>>> data = removePunctuation("I like chocolate cake!!(!! It's the best flavor..;.$ for real")
>>> data[0]
'I like chocolate cake It s the best flavor for real'
>>> data[1]
{'!': 4, '(': 1, "'": 1, '.': 3, ';': 1, '$': 1}
'''
Please note, this is an intro class so if theres a way to write it to be easily read and understood that would be much appreciated :)
Input filename A valid file name (as a Python string) of a .txt file saved in working directory Output list A list with the sequence of all the words contained in filename Example: .txt file for this doctest is available on Canvas and must be saved in the same directory as your .py file >>> get_words ('contents.txt') ['week', 'bat', 'aquatic', 'eggs', 'threatening', 'crash', 'educated', 'adjoining', 'bent', 'mice', 'belief', 'adjustment', 'blood', 'smooth', 'kaput', 'mountain', 'digestion', 'enchanted', 'wandering', 'fresh'] get_histogram(words) Takes a Python list words and returns a dictionary where the key is the length of a word and the value is the count of how many words in the list are of that length, other words, a histograr dictionary mapping length to word counts. Preconditions: While the function will receive lists, you should not make any assumptions about the size of words. Input words A Python list Output dict A dictionary mapping length to word counts Example: >>> get_histogram(['hello', 'there', 'spring', 'is', 'here']) {5: 2, 6:1, 2:1, 4: 1} >>> list_of_words = get_words('contents.txt') >>> get_histogram(list_of_words) {4: 4, 3:1, 7: 1, 11:1, 5: 4, 8: 2, 9: 4, 6: 2, 10: 1}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
