Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For Python 3 Write a function that takes a string argument. The function should create a dictionary. Iterate through the string and store the letter

For Python 3

Write a function that takes a string argument. The function should create a dictionary. Iterate through the string and store the letter frequency in the dictionary you created. The key will be the letter and the value will be the number of times the letter occurs in the word. Print the dictionary.

For example, calling the function with the string happy will print {'h': 1, 'a': 1, 'p': 2, 'y': 1}.

Using pneumonoultramicroscopicsilicovolcanoconiosis as an argument will print

{'p': 2, 'n': 4, 'e': 1, 'u': 2, 'm': 2, 'o': 9, 'l': 3, 't': 1, 'r': 2, 'a': 2, 'i': 6, 'c': 6, 's': 4, 'v': 1}.

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

PostgreSQL Up And Running A Practical Guide To The Advanced Open Source Database

Authors: Regina Obe, Leo Hsu

3rd Edition

1491963417, 978-1491963418

More Books

Students also viewed these Databases questions

Question

=+ (b) If ax(I) A(An I) for all I and if a > 0, then A( A) = 1.

Answered: 1 week ago

Question

1. Define mass and mediated communication

Answered: 1 week ago