1. Engineering
  2. Computer Science
  3. write a function uniquevalues that takes a dictionary as a...

Question: write a function uniquevalues that takes a dictionary as a...

Question details
  1. Write a function uniqueValues() that takes a dictionary as a parameter and returns a set of the unique values in the dictionary. If the dictionary is empty, the function returns the empty set. If any of the values in the dictionary are strings, capitalization of the strings matters when forming the set returned so that a string that differs by capitalization only would appear twice in the returned set. If any of the values in the dictionary cannot be added to a set, then those values are skipped. The function should not modify the dictionary passed as a parameter. Hint: Use exception handling for this process. Below you can see several sample runs of the function. Your function must work as described on any dictionary, not just the examples presented below:​​​​​​​ Python 3.7.2 Shell File Edit She Debug Options Window Help 48, 50, 14) >>> type (s) >>> s uniqueValues ((Mick: cookie, Mike: cookie, י Megan: Sweet Tarts = David: chocolate, Amber CHOCOLATE)) f cookie, Sweet Tarts,CHOCOLATE,chocolate >>> 3 - unicqueValues(f>) set ( >>> s = uniqueValues ((Amber: [50, 1968j, Erin: [14, 2004])) set ( >>> s = uniqueValues ((Amber: [50, 1968], Erin: [14, 2004], Gertrude: 2007, Prudence 2007) (2007) Ln: 22 Col: 4
Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution