Question: python Problem 2 Write code which, given a list 1. produces a dictionary D where: The keys of D are the unique elements of L

python
python Problem 2 Write code which, given a list 1. produces a

Problem 2 Write code which, given a list 1. produces a dictionary D where: The keys of D are the unique elements of L (i.e. each element of L appears only once). The value D[i] is the number of times that i appears in list L. Demonstrate that your code works for lists of strings, lists of integers, and lists containing both strings and integers. (it's fine to copy and paste your code for this, although if you happen to know how to define functions then you might find that more efficient). For example: L = ["a", "a", "b", "c"] # your code here # D # output {"a": 2, "b" : 1, "C" : 1}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!