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
Get step-by-step solutions from verified subject matter experts
