Question
def build_dictionary(string): d = dict() for x in string: if not d.get(x): d[x] = 1 else: d[x] += 1 return d Part 2: Create a
def build_dictionary(string): d = dict() for x in string: if not d.get(x): d[x] = 1 else: d[x] += 1 return d
Part 2:
Create a function named build_word_counter that has the same signature as build_dictionary. This function also returns a dictionary, however, it normalizes each word such that the case of the word is ignored (i.e. case insensitive). So the words LIKE, Like, like should be considered the same word (much like a regular dictionary would).
Part 3:
Create a function named build_letter_distribution that has the same signature as build_dictionary. This function returns a dictionary; however, each key will be a letter and the value will be the count that represents how many times that letter was found. Essentially you will have a letter distribution over a sentence (which is a list of words). The letters should be case insensitive.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started