Question: Develop a Python program that contains the following function: letter_word_count (text) The function should do the following: - letter_word_count (text) Receive a text (string) and

Develop a Python program that contains the following function:

letter_word_count (text)

The function should do the following: - letter_word_count (text) Receive a text (string) and for each letter, store the words that begin with that letter in a list. Then, for each word you find, check the first letter, if it is already in the dictionary, you will have to make an append to the existing list, and if that letter does not exist in the dictionary, add it with the first word. Important: It does not matter if the word is in lowercase or uppercase, the dictionary key is a MINUSCLE (see the test cases) and the word must remain in the original text format. The spaces are not counted.

EXAMPLE:

I affirm that I will not give or receive any unauthorized help on this exam, and that all work will be my own.

OUTPUT

{'i': ['I', 'I'], 'a': ['affirm', 'any', 'and', 'all'], 't': ['that', 'this', 'that'], 'w': ['will', 'work', 'will'], 'n': ['not'], 'g': ['give'], 'o': ['or', 'on', 'own.'], 'r': ['receive'], 'u': ['unauthorized'], 'h': ['help'], 'e': ['exam,'], 'b': ['be'], 'm': ['my']}

example2:

supercalifragilisticoespialidoso

output:

{'s': ['supercalifragilisticoespialidoso']}

EXAMPLE3:

All that is gold does not glitter, Not all those who wander are lost; The old that is strong does not wither, Deep roots are not reached by the frost.

output

{'a': ['All', 'all', 'are', 'are'], 't': ['that', 'those', 'The', 'that', 'the'], 'i': ['is', 'is'], 'g': ['gold', 'glitter,'], 'd': ['does', 'does', 'Deep'], 'n': ['not', 'Not', 'not', 'not'], 'w': ['who', 'wander', 'wither,'], 'l': ['lost;'], 'o': ['old'], 's': ['strong'], 'r': ['roots', 'reached'], 'b': ['by'], 'f': ['frost.']}

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!