Question: python plz Write a function named count_letter_occurrences (filename) which takes a filename as a parameter. Your function should read all the words in the text

 python plz Write a function named count_letter_occurrences (filename) which takes a

python plz

Write a function named count_letter_occurrences (filename) which takes a filename as a parameter. Your function should read all the words in the text file and calculate the number of times each letter appears in the file. Each word is separated by whitespace. The function should print a list of (letter: count) pairs. Note: You should convert all words to lower case. The letters should be sorted into standard alphabetical order as shown in the examples below. If a letter is not present in the file, then it should not be printed. Hint: You may find it useful to use a dictionary to store the letter.count pairs. For example: Test Result count_letter_occurrences('test1.txt') a : 1 e : 4 f : 1 h : 1 i : 4 1:4 m : 1 n: 3 0:2 P:1 S: 1 t: 1 W 1 y : 1

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 Databases Questions!