Question: Note: Please only use standard python covered in class lectures. Python libraries such as pandas, numpy are *not allowed in your work. 3. Write Python

Note: Please only use standard python covered in class lectures. Python libraries such as pandas, numpy are *not allowed in your work. 3. Write Python code to read the provided file sonnet.txt and print out the top 15 most used words and the counts in the file by length 2,3,4,-, 10 respectively. To achieve this, you can write several functions to perform the different tasks such as read from the file and print the information out. When processing the file content, you should remove these special characters: ?,- (ie. question mark, exclamation mark, period, comma, semi-colon and colon). The output from your code should look like the following: (15 points) Top 15, length of word: 2 to 408 my 390 of 369 in 323 is 167 164 145 142 as 121 it 111 by 93 do 84 on 80 Or 78 no 78 Top 15, length of word: 10 themselves 6 remembered 4 conscience 3 complexion 3 unkindness 2 unfathered 2 triumphant 2 temptation 2 speechless 2 resembling 2 possession 2 possessing 2 pilgrimage 2 perfection 2 obsequious 2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
