Write a function, common(list1, list2), that returns a dictionary. Each key in the dictionary corresponds to an element
Posted: Fri Jul 01, 2022 5:53 am
Write a function, common(list1, list2), that returns a dictionary. Each key in the dictionary corresponds to an element in both of the lists. The value for each key is the number of times that element appears across both lists. See the testing cell below for an example. HINT: There are multiple ways to solve this, but you may find the simplest involves building at least two intermediate dictionaries and multiple loops. Use this cell to test whether you have implemented the function correctly. [] assert common (["a", "b", "a", "d", "f", "a"], ["a", "b", "d", "d", "e"]) == { "a": 4, "b": 2, "d": 3 }