Question: Please look at the instructions, the output must match and it must pass the test cases, please read instructions. Provide a sample code with matching

Please look at the instructions, the output must match and it must pass the test cases, please read instructions. Provide a sample code with matching output and passing testn cases.
Creating information files
In this programming problem, you will be writing a program that reads in a text file (perhaps containing the contents of a book, poem, article, etc) and produces an information file based on the text. You will need to use one or more dictionaries to count words in the program. You may also use lists and / or sets.
The information file should contain the following information about the text:
The name of the text file
The total number of words.
The most used small, medium, and large words in the file. For the purposes of this project, the definitions of a small, medium, and large word is:
small: length 0-4, inclusive.
medium: length 5-7, inclusive.
large: length 8+, inclusive.
The frequencies and percentages for each word length category
The frequencies and percentages for each capitalized word category
The frequencies and percentages for each punctuated word category (consider only . and ,)
Name your Python file infofile.py.
Test Case:
if __name__=='__main__':
word_list = text_to_list("test.txt")
assert word_list ==['two', 'forks.', 'one', 'knife.', 'two', 'glasses.',\
'one', 'plate.', 'one', 'napkin.', 'his', 'glasses.', 'his', 'knife.']
word_counts = count_words(word_list)
assert word_counts =={'two':2, 'one':3, 'forks.':1, 'knife.':2,\
'glasses.':2, 'plate.':1, 'napkin.':1, 'his':2}
assert most_frequent(word_counts)==('one', 'knife.', 'glasses.')
assert count_capitalized(word_counts)==(0,8)
assert count_punctuated(word_counts)==(5,3)
assert count_sizes(word_counts)==(3,4,1)
write_results(word_counts, filename)
Please look at the instructions, the output must

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!