Write the following python program. a. Assign a sentence of at least 15 characters into a string constant b. Perform analysis that counts the
Write the following python program. a. Assign a sentence of at least 15 characters into a string constant b. Perform analysis that counts the number of each letter and saves the result into a dictionary Count letters ignoring case. So 'a' and 'A' are both counted as "A" The letters are the keys, and the counts are the values Find the letter(s) that appears most frequently by evaluating the dictionary counts c. Write print statements with appropriate descriptions for the items calculated in step "b'. Format print using the following examples. The printed dictionary must be sorted alphabetically Need to handle the cases of one most frequent letter vs. multiple letters. Example Output #1 The string being analyzed is: "WAS IT A RAT I SAW?" 1. Dictionary of letter counts: ('A': 4, 'I': 2, 'R': 1, 'S': 2, 'T': 2, 'W': 2) 2. Most frequent letter "A" appears 4 times. Example Output #2 The string being analyzed is: "Wwwas it a rat I saw?" 1. Dictionary of letter counts: ('A': 4, '1': 2, 'R': 1, 'S': 2, "T': 2, 'W': 4) 2. Most frequent letters ['A', 'W'] appear 4 times.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started