Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

this python problem Problem 1 Write a function named initialLetterCount that takes one parameter, wordList a list of words. Create and return a dictionary in

this python problem

Problem 1

Write a function named initialLetterCount that takes one parameter, wordList a list of words. Create and return a dictionary in which each initial letter of a word in wordList is a key and the corresponding value is the number of words in wordList that begin with that letter. The keys in the dictionary should be case-sensitive, which means 'a' and 'A' are two different keys.

For example, the following is correct output:

horton = ['I', 'say', 'what', 'I', 'mean', 'and', 'I', 'mean', 'what', 'I', 'say']

print(initialLetterCount(horton))

{'I': 4, 's': 2, 'w': 2, 'm': 2, 'a': 1}

Problem 2

Write a function named initialLetters that takes one parameter, wordList - a list of words. Create and return a dictionary in which each initial letter of a word in wordList is a key and the corresponding value is a list of the words in wordList that begin with that letter. There should be no duplicate words in any value in the dictionary.

For example, the following is correct output:

print(initialLetters(horton))

{'I': ['I'], 's': ['say'], 'w': ['what'], 'm': ['mean'], 'a': ['and']}

Problem 3

Write a function named shareALetter that takes one parameter, wordList - a list of words. Create and return a dictionary in which each word in wordList is a key and the corresponding value is a list of all the words in wordList that share at least one letter with that word. There should be no duplicate words in any value in the dictionary.

For example, the following is correct output:

print(shareALetter(horton))

{'I': ['I'], 'say': ['say', 'what', 'mean', 'and'], 'what': ['say', 'what', 'mean', 'and'], 'mean': ['say', 'what', 'mean', 'and'], 'and': ['say', 'what', 'mean', 'and']}

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

What are the Ohio State University leadership styles?

Answered: 1 week ago