Question: python The list below displays the most frequent 1000 words in the English language. Make a list of tuples where each tuple has a letter
python
The list below displays the most frequent 1000 words in the English language. Make a list of tuples where each tuple has a letter and the count of how many words start with the letter in the mostfrequent1000 list. Your list should start the tuple with 'a'. E.g.: [ ('a', 38), ---, ('q', 6)]. This means that 38 words start with 'a', and 6 words start with ' q '. Finally, make a horizontal bar chart with the letters on the y-axis and the frequency of the letters on the x-axis. Make sure to include axis labels and the plot title. mostfrequent1000 = ['the', 'of', 'to', 'and', 'a', 'in', 'is', 'it', 'you', 'that', 'he', 'was', 'for', 'on', 'are', 'with', 'as \#from collections import Counter \#firstletters = \#tuples \#letters = \#counts [(t,69),(0,29),(a,38),(i,18),(y,8),(h,41),(w,58),(f,58),(I,1),(b,60),(n,28),(s,1 50), ('c', 86), ('u', 7), ('e', 38), ('d', 48), ('m', 57), ('l', 43), ('g', 30), ('p', 62), ('k', 8), ('r', 42), ('v', 10), (jj,5),(q,6)] ['t', 'o', 'a', 'i', 'y', 'h', 'w', 'f', 'I', 'b', 'n', 's', 'c', 'u', 'e', 'd', 'm', 'l', 'g', 'p', 'k', 'r', 'v', 'j', 'q'] [69,29,38,18,8,41,58,58,1,60,28,150,86,7,38,48,57,43,30,62,8,42,10,5,6] \#import seaborn as sns \#import matplotlib.pyplot as plt \#sns.set (font_scale =2 ) \#plt.figure(figsize =(15,10) ) \#axes=sns.barplot (x=,y=) \#plt.title( 'Bar Plot of first letter frequency in 1000 most frequent words') \#plt.xlabel('Letters') \#plt.ylabel('Frequency') \#plt.show()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
