Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python assignment: Using function write a script that gets a sentence from the user and then uses a dictionary to summarize the number of occurrences

Python assignment:

Using function write a script that gets a sentence from the user and then uses a dictionary to summarize the number of occurrences of each letter. Ignore case, ignore blanks, and ignore punctuation. Display a two-column table of the letters (in alphabetical order) and their counts.

Example program outputs:

Give me a sentence, and I'll count the letters: A quick brown fox jumps over the lazy dog

a: 2 b: 1

c: 1 d: 1

e: 2 f: 1

g: 1 h: 1

i: 1 j: 1

k: 1 l: 1

m: 1 n: 1

o: 4 p: 1

q: 1 r: 2

s: 1 t: 1

u: 2 v: 1

w: 1 x: 1

y: 1 z: 1

Give me a sentence, and I'll count the letters: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

a: 7 b: 1

c: 4 d: 8

e: 11 g: 2

i: 11 l: 6

m: 6 n: 5

o: 10 p: 3

q: 1 r: 6

s: 6 t: 9

u: 6

(notice f, h, j, k, and v-z did not print in the second example, because they werent in the string)

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

The Database Management Systems

Authors: Patricia Ward, George A Dafoulas

1st Edition

1844804526, 978-1844804528

More Books

Students also viewed these Databases questions

Question

Explain what scientific methods are and why they are important.

Answered: 1 week ago