Divine O.

asked • 04/24/20

Need Help with this Computer Science questions

consider the following function named "mystery"

def mystery (slist):

d = {}

for w in slist:

n = len(w)

if n not in d:

d[n] = [w]

else:

d[n].append(w)

return d


Assume the mystery is called as follows:

mylist = ['the', 'cat', 'in', 'hat', 'ran', 'fast', 'telephone]

answer = mystery(mylist)


a. what do the keys in the dictionary stored in "answer" represent?

b. What value is associated with the key that is equal to "4" in the dictionary stored in "answer"?

2 Answers By Expert Tutors

By:

Wyatt M. answered • 04/24/20

Tutor
0 (0)

Experienced Silicon Valley software developer

Visalbotr C. answered • 04/24/20

Tutor
5 (23)

Cal Poly SLO Grad For Computer Science Tutoring

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.