Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

4.2 Stay under 80 characters on all code and comment lines Ask for input() with descriptive prompts telling users what is expected o Especially remember

4.2 Stay under 80 characters on all code and comment lines Ask for input() with descriptive prompts telling users what is expected o Especially remember to tell user what delimiter youre expecting when using split() Make sure to validate user input for data type, value range and other problem requirements Print output that clearly explains what is being printed (where necessary) o In other words, dont just print a 5 unless its clear what that 5 represents. Import statements should be immediately after the program docstring Make sure to include # line comments (just a few in each program, dont go crazy) Use snake_case (lower case plus underscores) for variables CONSTANT variables must be all upper case and immediately following any import statements Do NOT create user defined functions for this assignment. Only base python functions and methods can be used, along with those in the modules listed below. Modules Allowed You may only import the following modules into your programs and use their methods and attributes, unless first receiving special (and unlikely) permission from your facilitator: math operator os re string sys

4.2: 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, 'I': 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft Visual Basic 2005 For Windows Mobile Web Office And Database Applications Comprehensive

Authors: Gary B. Shelly, Thomas J. Cashman, Corinne Hoisington

1st Edition

0619254823, 978-0619254827

More Books

Students also viewed these Databases questions

Question

5. Identify three characteristics of the dialectical approach.

Answered: 1 week ago

Question

7. Identify six intercultural communication dialectics.

Answered: 1 week ago