Question: This program is about dictionaries.We want to use a dictionary to store frequency count of each letter in a string.Write Python program to do the

This program is about dictionaries.We want to use a dictionary to store frequency count of each letter in a string.Write Python program to do the following:

(a) Ask the user to enter a string.Convert all letters to uppercase.Count the frequency of each letter in the string. Store the frequency counts in a dictionary.You should count letters only.Do not count any other characters such as digits and space.Display the dictionary.

(b) Ask the user to enter a letter.Convert it to uppercase.Check whether the letter is in the dictionary.If it is not, display the message "Letter not in dictionary".Otherwise, display the frequency count of that letter, remove the letter from the dictionary and display the dictionary after that letter has been removed.

(c) Create list to store the letters that are in the dictionary.Sort and display the list.

The following is an example.

Enter a string: Magee, Mississippi

Dictionary:{'M': 2, 'A': 1, 'G': 1, 'E': 2, 'I': 4, 'S': 4, 'P': 2}

Choose a letter: s

Frequency count of that letter: 4

Dictionary after that letter removed:{'M': 2, 'A': 1, 'G': 1, 'E': 2, 'I': 4, 'P': 2}

Letters sorted: ['A', 'E', 'G', 'I', 'M', 'P']

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