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

plz select python
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
Get step-by-step solutions from verified subject matter experts
