Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions