about | help | code help+videos | done | prefs |
Write a function called count_duplicates(mappings)that takes a list of mappings (specifying a dictionary), creates the dictionary, and returns the number of values in the dictionary that appear two or more times. Recall that to create a dictionary from mappings you need the code D = {} for mapping in mappings: key = mapping[0] value = mapping[1] D[key] = value # at this spot, outside the loop above, it's as if D was the parameterPaste this code into the space below, then solve the problem with the dictionary D. count_duplicates([['A', 1], ['B', 2], ['C', 3], ['D', 4], ['E', 5]]) → 0 count_duplicates([['A', 1], ['B', 2], ['C', 2], ['D', 3], ['E', 4]]) → 1 count_duplicates([['A', 1], ['B', 1], ['C', 2], ['D', 2], ['E', 3]]) → 2 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 100
Copyright Nick Parlante 2017 - privacy