Question: 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

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