Answered You can hire a professional tutor to get the answer.

QUESTION

I need to make a Python dictionary where thevalueis alist. Thekeycan be whatever type I want. Then I need to design the dictionary so that it could...

I need to make a Python dictionary where the value is a list. The key can be whatever type I want. 

Then I need to design the dictionary so that it could be useful for something meaningful to you. After, I need to make at least three different items in it.

Next I need to consider the invert_dict function

def invert_dict(d):

   inverse = dict()

   for key in d:

      val = d[key]

     if val not in inverse:

        inverse[val] = [key]

     else:

        inverse[val].append(key)

   return inverse 

I need to modify this function so that it can invert your dictionary. In particular, the function will need to turn each of the list items into separate keys in the inverted dictionary. 

Then I need to run your modified invert_dict function on my dictionary. Lastly, I need to print the original dictionary and the inverted one. 

I need to include my Python program and the output. 

I need to also explain what is useful about my dictionary. Then I need to explain whether the inverted dictionary is useful or meaningful, and why. 

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question